Class: Almicube::Builder

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Builder

Returns a new instance of Builder.



5
6
7
8
9
10
11
# File 'lib/almicube/builder.rb', line 5

def initialize(options={})
  @class_name = options[:class_name]
  @attribute_name = options[:attribute_name]
  @selector = select_selector(options[:selector])
  @bundler = select_bundler(options[:bundler])
  @date = options[:date] || Date.today
end

Instance Attribute Details

#attribute_nameObject

Returns the value of attribute attribute_name.



3
4
5
# File 'lib/almicube/builder.rb', line 3

def attribute_name
  @attribute_name
end

#bundlerObject

Returns the value of attribute bundler.



3
4
5
# File 'lib/almicube/builder.rb', line 3

def bundler
  @bundler
end

#class_nameObject

Returns the value of attribute class_name.



3
4
5
# File 'lib/almicube/builder.rb', line 3

def class_name
  @class_name
end

#dateObject

Returns the value of attribute date.



3
4
5
# File 'lib/almicube/builder.rb', line 3

def date
  @date
end

#selectorObject

Returns the value of attribute selector.



3
4
5
# File 'lib/almicube/builder.rb', line 3

def selector
  @selector
end

Instance Method Details

#data(date = nil) ⇒ Object



13
14
15
16
# File 'lib/almicube/builder.rb', line 13

def data(date=nil)
  date ||= self.date
  Almicube::Ranking::DataRanking.new options.merge( date: date )
end

#optionsObject



18
19
20
21
22
23
24
# File 'lib/almicube/builder.rb', line 18

def options
  { selector: selector,
    bundler: bundler,
    date: date,
    class_name: class_name,
    attribute_name: attribute_name }
end