Module: Super::Useful::Builder

Included in:
Display::SchemaTypes::Builder
Defined in:
lib/super/useful/builder.rb

Instance Method Summary collapse

Instance Method Details

#builder(method_name) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/super/useful/builder.rb', line 6

def builder(method_name)
  alias_method("original_#{method_name}", method_name)

  define_method(method_name) do
    send("original_#{method_name}")
    self
  end
end

#builder_with_block(method_name) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/super/useful/builder.rb', line 15

def builder_with_block(method_name)
  alias_method("original_#{method_name}", method_name)

  define_method(method_name) do |&block|
    send("original_#{method_name}", &block)
    self
  end
end