Module: Super::Useful::Builder

Included in:
Display::SchemaTypes::Badge, 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 |*args|
    send("original_#{method_name}", *args)
    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 |*args, &block|
    send("original_#{method_name}", *args, &block)
    self
  end
end