blob: 52c3773eea95482bffe1f9b1771c1ff97d867fb4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
class Object #:nodoc:
# A Ruby-ized realization of the K combinator, courtesy of Mikael Brockman.
#
# def foo
# returning values = [] do
# values << 'bar'
# values << 'baz'
# end
# end
#
# foo # => ['bar', 'baz']
#
def returning(value)
yield
value
end
def with_options(options)
yield ActiveSupport::OptionMerger.new(self, options)
end
def to_json
ActiveSupport::JSON.encode(self)
end
end
|