Class: RestEasy::Resource::MetaCollector

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

Instance Method Summary collapse

Constructor Details

#initializeMetaCollector

Returns a new instance of MetaCollector.



105
106
107
# File 'lib/rest_easy/resource.rb', line 105

def initialize
  @data = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



113
114
115
116
117
118
119
120
# File 'lib/rest_easy/resource.rb', line 113

def method_missing(name, *args)
  key = name.to_s
  if key.end_with?("=")
    @data[key.chomp("=").to_sym] = args.first
  else
    @data[name.to_sym]
  end
end

Instance Method Details

#respond_to_missing?(_name, _include_private = false) ⇒ Boolean

Returns:



122
123
124
# File 'lib/rest_easy/resource.rb', line 122

def respond_to_missing?(_name, _include_private = false)
  true
end

#to_hObject



109
110
111
# File 'lib/rest_easy/resource.rb', line 109

def to_h
  @data
end