Class: Vedeu::Builder

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Builder

Returns a new instance of Builder.



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

def initialize(name)
  @name = name.to_s
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, arg, &block) ⇒ Object (private)



47
48
49
# File 'lib/vedeu/support/builder.rb', line 47

def method_missing(method_name, arg, &block)
  user_attributes[method_name] = arg
end

Class Method Details

.build(name, &block) ⇒ Object



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

def self.build(name, &block)
  new(name).build(&block)
end

Instance Method Details

#build(&block) ⇒ Object



14
15
16
17
18
# File 'lib/vedeu/support/builder.rb', line 14

def build(&block)
  self.instance_eval(&block)

  Persistence.create(attributes)
end