Class: Smplkit::Config::ConfigChangeEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/smplkit/config/client.rb

Overview

Describes a single config value change. Frozen — fields are set at construction and cannot be mutated afterward.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_id:, item_key:, old_value:, new_value:, source:) ⇒ ConfigChangeEvent

Returns a new instance of ConfigChangeEvent.



113
114
115
116
117
118
119
120
# File 'lib/smplkit/config/client.rb', line 113

def initialize(config_id:, item_key:, old_value:, new_value:, source:)
  @config_id = config_id
  @item_key = item_key
  @old_value = old_value
  @new_value = new_value
  @source = source
  freeze
end

Instance Attribute Details

#config_idObject (readonly)

Returns the value of attribute config_id.



111
112
113
# File 'lib/smplkit/config/client.rb', line 111

def config_id
  @config_id
end

#item_keyObject (readonly)

Returns the value of attribute item_key.



111
112
113
# File 'lib/smplkit/config/client.rb', line 111

def item_key
  @item_key
end

#new_valueObject (readonly)

Returns the value of attribute new_value.



111
112
113
# File 'lib/smplkit/config/client.rb', line 111

def new_value
  @new_value
end

#old_valueObject (readonly)

Returns the value of attribute old_value.



111
112
113
# File 'lib/smplkit/config/client.rb', line 111

def old_value
  @old_value
end

#sourceObject (readonly)

Returns the value of attribute source.



111
112
113
# File 'lib/smplkit/config/client.rb', line 111

def source
  @source
end

Instance Method Details

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



122
123
124
125
126
127
# File 'lib/smplkit/config/client.rb', line 122

def ==(other)
  other.is_a?(ConfigChangeEvent) &&
    config_id == other.config_id && item_key == other.item_key &&
    old_value == other.old_value && new_value == other.new_value &&
    source == other.source
end

#hashObject



130
# File 'lib/smplkit/config/client.rb', line 130

def hash = [config_id, item_key, old_value, new_value, source].hash