Class: Context
- Inherits:
-
Object
- Object
- Context
- Defined in:
- lib/context.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#message ⇒ Object
Returns the value of attribute message.
-
#old_data ⇒ Object
readonly
Returns the value of attribute old_data.
Instance Method Summary collapse
- #cancel ⇒ Object
- #canceld? ⇒ Boolean
-
#initialize(message, keys = {}) ⇒ Context
constructor
A new instance of Context.
- #verify ⇒ Object
Constructor Details
#initialize(message, keys = {}) ⇒ Context
Returns a new instance of Context.
7 8 9 10 11 12 |
# File 'lib/context.rb', line 7 def initialize(, keys = {}) @message = # the obj holding the parsed chunk @cancel = false @old_data = keys @data = keys end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
5 6 7 |
# File 'lib/context.rb', line 5 def data @data end |
#message ⇒ Object
Returns the value of attribute message.
5 6 7 |
# File 'lib/context.rb', line 5 def @message end |
#old_data ⇒ Object (readonly)
Returns the value of attribute old_data.
4 5 6 |
# File 'lib/context.rb', line 4 def old_data @old_data end |
Instance Method Details
#cancel ⇒ Object
26 27 28 |
# File 'lib/context.rb', line 26 def cancel @cancel = true end |
#canceld? ⇒ Boolean
22 23 24 |
# File 'lib/context.rb', line 22 def canceld? @cancel end |
#verify ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/context.rb', line 14 def verify @data.each do |key, _value| next if @old_data.key? key raise "Error: invalid data key '#{key}'\n valid keys: #{@old_data.keys}" end end |