Class: Doing::FluentValue

Inherits:
BasicObject
Defined in:
lib/doing/fluent_value.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(it) ⇒ FluentValue

Returns a new instance of FluentValue.



5
6
7
# File 'lib/doing/fluent_value.rb', line 5

def initialize(it)
  @it = it
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/doing/fluent_value.rb', line 9

def method_missing(method, *args, &block)
  result = if it.respond_to?(method)
    it.send(method, *args, &block)
  else
    ::Kernel.send(method, *args.clone.unshift(it), &block)
  end
  FluentValue.new(result)
end

Instance Attribute Details

#itObject (readonly)

Returns the value of attribute it.



3
4
5
# File 'lib/doing/fluent_value.rb', line 3

def it
  @it
end