Class: Materialize::Repo

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token = nil) ⇒ Repo



6
7
8
# File 'lib/materialize/repo.rb', line 6

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



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/materialize/repo.rb', line 10

def method_missing(query, *args, &block)
  data_source_class = args[0]
  options           = args[1] || {}
  args_to_pass      = options[:args]

  data, builder_class = process(data_source_class, query, args_to_pass)
  options.delete(:args)

  if data.is_a?(Array)
    builder_class.build_all(data, self, options)
  else
    builder_class.build(data, self, options)
  end
end

Instance Attribute Details

#tokenObject (readonly)

Returns the value of attribute token.



4
5
6
# File 'lib/materialize/repo.rb', line 4

def token
  @token
end