Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/awein/object.rb
Instance Method Summary collapse
- #is?(other_object) ⇒ Boolean
- #is_not?(other_object) ⇒ Boolean
- #rcall(*args) ⇒ Object
- #to_hms ⇒ Object
- #to_normal_time ⇒ Object
Instance Method Details
#is?(other_object) ⇒ Boolean
24 25 26 |
# File 'lib/awein/object.rb', line 24 def is?(other_object) self == other_object end |
#is_not?(other_object) ⇒ Boolean
28 29 30 |
# File 'lib/awein/object.rb', line 28 def is_not?(other_object) self != other_object end |
#rcall(*args) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/awein/object.rb', line 11 def rcall(*args) = {:d => nil}.merge(args.last.is_a?(Hash) ? args.pop : {}) target = self while target && m = args.shift target = target.send(m) if target.respond_to?(m) end return target if target return [:d].call if [:d].respond_to? :call return [:d] end |
#to_hms ⇒ Object
3 4 5 |
# File 'lib/awein/object.rb', line 3 def to_hms Time.at(self.to_f).utc.strftime("%H:%M:%S") end |
#to_normal_time ⇒ Object
7 8 9 |
# File 'lib/awein/object.rb', line 7 def to_normal_time self.strftime("%H:%M %p") end |