Class: Manufacturable::Builder

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build(*args, **kwargs, &block) ⇒ Object



6
7
8
# File 'lib/manufacturable/builder.rb', line 6

def self.build(*args, **kwargs, &block)
  self.new(*args, **kwargs, &block).build
end

.build_all(*args, **kwargs, &block) ⇒ Object



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

def self.build_all(*args, **kwargs, &block)
  self.new(*args, **kwargs, &block).build_all
end

.build_one(*args, **kwargs, &block) ⇒ Object



10
11
12
# File 'lib/manufacturable/builder.rb', line 10

def self.build_one(*args, **kwargs, &block)
  self.new(*args, **kwargs, &block).build_one
end

.builds?(*args, **kwargs, &block) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/manufacturable/builder.rb', line 18

def self.builds?(*args, **kwargs, &block)
  self.new(*args, **kwargs, &block).builds?
end

Instance Method Details

#buildObject



22
23
24
# File 'lib/manufacturable/builder.rb', line 22

def build
  return_first? ? instances.first : instances
end

#build_allObject



30
31
32
# File 'lib/manufacturable/builder.rb', line 30

def build_all
  instances
end

#build_oneObject



26
27
28
# File 'lib/manufacturable/builder.rb', line 26

def build_one
  last_instance
end

#builds?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/manufacturable/builder.rb', line 34

def builds?
  Registrar.registered_keys(type).include?(key)
end