Class: Foxy::Adverb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(value) ⇒ Adverb
Returns a new instance of Adverb.
9
10
11
|
# File 'lib/foxy/adverb.rb', line 9
def initialize(value)
@value = value
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
25
26
27
|
# File 'lib/foxy/adverb.rb', line 25
def method_missing(m, *args, &block)
and_then { |instance| instance.public_send(m, *args, &block) }
end
|
Instance Attribute Details
Returns the value of attribute value.
3
4
5
|
# File 'lib/foxy/adverb.rb', line 3
def value
@value
end
|
Class Method Details
.define(&block) ⇒ Object
5
6
7
|
# File 'lib/foxy/adverb.rb', line 5
def self.define(&block)
Class.new(self) { define_method(:and_then, &block) }
end
|
Instance Method Details
#and_then {|value| ... } ⇒ Object
13
14
15
|
# File 'lib/foxy/adverb.rb', line 13
def and_then
yield value
end
|
#tap(*args, &block) ⇒ Object
21
22
23
|
# File 'lib/foxy/adverb.rb', line 21
def tap(*args, &block)
method_missing(:tap, *args, &block)
end
|
#then(&block) ⇒ Object
17
18
19
|
# File 'lib/foxy/adverb.rb', line 17
def then(&block)
self.class.new(&block)
end
|