Class: NoSE::FieldSetting

Inherits:
Object show all
Defined in:
lib/nose/statements.rb

Overview

The setting of a field from an Update statement

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field, value) ⇒ FieldSetting

Returns a new instance of FieldSetting.



507
508
509
510
511
512
# File 'lib/nose/statements.rb', line 507

def initialize(field, value)
  @field = field
  @value = value

  freeze
end

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.



505
506
507
# File 'lib/nose/statements.rb', line 505

def field
  @field
end

#valueObject (readonly)

Returns the value of attribute value.



505
506
507
# File 'lib/nose/statements.rb', line 505

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?

Compare settings equal by their field



519
520
521
# File 'lib/nose/statements.rb', line 519

def ==(other)
  other.field == @field
end

#hashObject

Hash by field and value



525
526
527
# File 'lib/nose/statements.rb', line 525

def hash
  Zlib.crc32 [@field.id, @value].to_s
end

#inspectObject



514
515
516
# File 'lib/nose/statements.rb', line 514

def inspect
  "#{@field.inspect} = #{value}"
end