Class: Megalith::Index
- Inherits:
-
Object
- Object
- Megalith::Index
- Defined in:
- lib/megalith/scheme.rb
Instance Attribute Summary collapse
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
Instance Method Summary collapse
- #fetch ⇒ Object (also: #get)
-
#initialize(base_url, index) ⇒ Index
constructor
A new instance of Index.
- #method_missing(action, *args) ⇒ Object
- #params ⇒ Object (also: #available_methods)
- #to_hash ⇒ Object
Constructor Details
#initialize(base_url, index) ⇒ Index
Returns a new instance of Index.
171 172 173 174 |
# File 'lib/megalith/scheme.rb', line 171 def initialize(base_url, index) @base_url = base_url @index = index end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(action, *args) ⇒ Object
176 177 178 |
# File 'lib/megalith/scheme.rb', line 176 def method_missing(action, *args) return @index[action.to_s.to_sym] rescue nil end |
Instance Attribute Details
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
169 170 171 |
# File 'lib/megalith/scheme.rb', line 169 def base_url @base_url end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
170 171 172 |
# File 'lib/megalith/scheme.rb', line 170 def index @index end |
Instance Method Details
#fetch ⇒ Object Also known as: get
187 188 189 |
# File 'lib/megalith/scheme.rb', line 187 def fetch Novel.new(@base_url, self.log, self.key) end |
#params ⇒ Object Also known as: available_methods
180 |
# File 'lib/megalith/scheme.rb', line 180 def params() @index.keys.map{|k|k.to_sym} ; end |
#to_hash ⇒ Object
183 184 185 |
# File 'lib/megalith/scheme.rb', line 183 def to_hash @index end |