Skip to content

Conversation

nandhasuhendra
Copy link

No description provided.

require "bundler/gem_tasks"
# frozen_string_literal: true

require 'bundler/gem_tasks'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

class_eval "def #{value}?() self.#{field_name} == :#{value} end"
class_eval "def #{value}!() update_attributes! :#{field_name} => :#{value} end"
class_eval "def #{value}?() self.#{field_name} == :#{value} end", __FILE__, __LINE__
class_eval "def #{value}!() update_attributes! :#{field_name} => :#{value} end", __FILE__, __LINE__
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [107/80]

end

def define_string_accessor(field_name, value)
class_eval "def #{value}?() self.#{field_name} == :#{value} end"
class_eval "def #{value}!() update_attributes! :#{field_name} => :#{value} end"
class_eval "def #{value}?() self.#{field_name} == :#{value} end", __FILE__, __LINE__
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [92/80]

class_eval "def #{value}?() self.#{field_name}.include?(:#{value}) end"
class_eval "def #{value}!() update_attributes! :#{field_name} => (self.#{field_name} || []) + [:#{value}] end"
class_eval "def #{value}?() self.#{field_name}.include?(:#{value}) end", __FILE__, __LINE__
class_eval "def #{value}!() update_attributes! :#{field_name} => (self.#{field_name} || []) + [:#{value}] end",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [119/80]

end

def define_array_accessor(field_name, value)
class_eval "def #{value}?() self.#{field_name}.include?(:#{value}) end"
class_eval "def #{value}!() update_attributes! :#{field_name} => (self.#{field_name} || []) + [:#{value}] end"
class_eval "def #{value}?() self.#{field_name}.include?(:#{value}) end", __FILE__, __LINE__
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [99/80]


require 'mongoid/enum/version'
require 'mongoid/enum/validators/multiple_validator'
require 'mongoid/enum/configuration'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

# frozen_string_literal: true

require 'mongoid/enum/version'
require 'mongoid/enum/validators/multiple_validator'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

require "mongoid/enum/configuration"
# frozen_string_literal: true

require 'mongoid/enum/version'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

module Mongoid
module Enum
class Configuration
attr_accessor :field_name_prefix

def initialize
self.field_name_prefix = "_"
self.field_name_prefix = '_'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

end
end

def add_error_message(record, attribute)
record.errors[attribute] << (options[:message] || "is not in #{options[:in].join ", "}")
record.errors[attribute] << (options[:message] || "is not in #{options[:in].join ', '}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [98/80]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants