Class: ParsedData

Inherits:
Object
  • Object
show all
Defined in:
lib/message_handler.rb

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ ParsedData

Returns a new instance of ParsedData.



88
89
90
# File 'lib/message_handler.rb', line 88

def initialize(data)
  @data = data
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



96
97
98
99
100
101
102
# File 'lib/message_handler.rb', line 96

def method_missing(method_name, *args, &block)
  if @data.key?(method_name)
    @data[method_name]
  else
    super
  end
end

Instance Method Details

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


104
105
106
# File 'lib/message_handler.rb', line 104

def respond_to_missing?(method_name, include_private = false)
  @data.key?(method_name) || super
end

#typeObject



92
93
94
# File 'lib/message_handler.rb', line 92

def type
  @data[:type]
end