Module: Tieable

Included in:
Object
Defined in:
lib/tieable.rb,
lib/tieable/version.rb

Constant Summary collapse

VERSION =
"0.0.1"

Instance Method Summary collapse

Instance Method Details

#tie(*args, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/tieable.rb', line 4

def tie(*args, &block)
  if args.size > 0
    if args.first.nil?
      self
    else
      self.public_send(*args, &block)
    end
  elsif block_given?
    yield(self) || self
  else
    raise ArgumentError, "#{self.class}#tie method requires any arguments or block"
  end
end