Class: TimeZoneProxy
- Inherits:
-
Object
- Object
- TimeZoneProxy
- Defined in:
- lib/clock/time_zone_proxy.rb
Instance Attribute Summary collapse
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
- #==(rhs) ⇒ Object
-
#initialize(target) ⇒ TimeZoneProxy
constructor
A new instance of TimeZoneProxy.
- #method_missing(method, *args) ⇒ Object
- #now ⇒ Object
- #today ⇒ Object
Constructor Details
#initialize(target) ⇒ TimeZoneProxy
Returns a new instance of TimeZoneProxy.
4 5 6 7 |
# File 'lib/clock/time_zone_proxy.rb', line 4 def initialize(target) raise "Target time zone may not be nil" if target.nil? @target = target end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
21 22 23 |
# File 'lib/clock/time_zone_proxy.rb', line 21 def method_missing(method, *args) target.send(method, *args) end |
Instance Attribute Details
#target ⇒ Object (readonly)
Returns the value of attribute target.
2 3 4 |
# File 'lib/clock/time_zone_proxy.rb', line 2 def target @target end |
Instance Method Details
#==(rhs) ⇒ Object
17 18 19 |
# File 'lib/clock/time_zone_proxy.rb', line 17 def ==(rhs) super(rhs) || self.target == rhs || (rhs.respond_to?(:target) && self.target == rhs.target) end |