Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/tiun/mixins.rb
Instance Method Summary collapse
Instance Method Details
#blank? ⇒ Boolean
2 3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/tiun/mixins.rb', line 2 def blank? case self when NilClass, FalseClass true when TrueClass false when Hash, Array !self.any? else self.to_s == "" end end |
#to_os ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/tiun/mixins.rb', line 15 def to_os if self.respond_to?(:to_h) if self.is_a?(OpenStruct) self else OpenStruct.new(self.to_h.map {|(x, y)| [x.to_s, y.respond_to?(:map) && y.to_os || y] }.to_h) end else OpenStruct.new("" => self) end rescue binding.pry end |