Class: BB::Factory

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/b_b/factory.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFactory

Returns a new instance of Factory.



8
9
10
11
# File 'lib/b_b/factory.rb', line 8

def initialize
  @filters = []
  @options = {}
end

Instance Attribute Details

#filtersObject

Returns the value of attribute filters.



5
6
7
# File 'lib/b_b/factory.rb', line 5

def filters
  @filters
end

#optionsObject

Returns the value of attribute options.



5
6
7
# File 'lib/b_b/factory.rb', line 5

def options
  @options
end

#type_of_componentObject

Returns the value of attribute type_of_component.



5
6
7
# File 'lib/b_b/factory.rb', line 5

def type_of_component
  @type_of_component
end

Class Method Details

.build(name) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/b_b/factory.rb', line 47

def build(name)
  decorator = FactoryDecorator.const_get(format_decorator_name(name))

  new.extend(decorator).tap do |factory|
    factory.type_of_component = name
  end
end

Instance Method Details

#append_formatted_filters(args) ⇒ Object



15
16
17
18
# File 'lib/b_b/factory.rb', line 15

def append_formatted_filters(args)
  extract_options!(args)
  format_filters(args).each { |filter| filters << filter }
end