Class: Materialize::Repo
- Inherits:
-
Object
- Object
- Materialize::Repo
- Includes:
- Utils
- Defined in:
- lib/materialize/repo.rb
Instance Attribute Summary collapse
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
-
#initialize(token = nil) ⇒ Repo
constructor
A new instance of Repo.
- #method_missing(query, *args, &block) ⇒ Object
Methods included from Utils
Constructor Details
#initialize(token = nil) ⇒ Repo
Returns a new instance of Repo.
7 8 9 |
# File 'lib/materialize/repo.rb', line 7 def initialize(token = nil) @token = token end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(query, *args, &block) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/materialize/repo.rb', line 11 def method_missing(query, *args, &block) data_source_class = args[0] = args[1] || {} args_to_pass = [:args] data, builder_class = process(data_source_class, query, args_to_pass) .delete(:args) if data.is_a?(Hash) and !data['message'].nil? Response.new data elsif data.is_a?(Array) builder_class.build_all(data, self, ) else builder_class.build(data, self, ) end end |
Instance Attribute Details
#token ⇒ Object (readonly)
Returns the value of attribute token.
5 6 7 |
# File 'lib/materialize/repo.rb', line 5 def token @token end |