Class: Object

Inherits:
BasicObject
Defined in:
lib/awein/object.rb

Instance Method Summary collapse

Instance Method Details

#is?(other_object) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/awein/object.rb', line 24

def is?(other_object)
  self == other_object
end

#is_not?(other_object) ⇒ Boolean

Returns:

  • (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)
  options = {: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 options[:d].call if options[:d].respond_to? :call
  return options[:d]
end

#to_hmsObject



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_timeObject



7
8
9
# File 'lib/awein/object.rb', line 7

def to_normal_time
  self.strftime("%H:%M %p")
end