Class: TryDefault::Handler
Instance Method Summary
collapse
Constructor Details
#initialize(proxy = nil) ⇒ Handler
Returns a new instance of Handler.
13
14
15
|
# File 'lib/try_default/default.rb', line 13
def initialize(proxy=nil)
@proxy = proxy
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args) ⇒ Object
16
17
18
19
|
# File 'lib/try_default/default.rb', line 16
def method_missing(sym, *args)
@proxy = @proxy.send(sym, *args) rescue nil
self
end
|
Instance Method Details
#default(value = '') ⇒ Object
20
21
22
|
# File 'lib/try_default/default.rb', line 20
def default(value = '')
@proxy ||= value
end
|
29
30
31
|
# File 'lib/try_default/default.rb', line 29
def inspect
@proxy.inspect
end
|
23
24
25
|
# File 'lib/try_default/default.rb', line 23
def to_s
@proxy.to_s
end
|
26
27
28
|
# File 'lib/try_default/default.rb', line 26
def to_str
to_s
end
|