Class: String

Inherits:
Object show all
Defined in:
lib/ripple/core_ext/casting.rb,
lib/ripple/core_ext/indexes.rb

Overview

Fix for 1.8, in which String is Enumerable

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.ripple_cast(value) ⇒ Object



59
60
61
62
# File 'lib/ripple/core_ext/casting.rb', line 59

def self.ripple_cast(value)
  return nil if value.nil?
  value.respond_to?(:to_s) && value.to_s or raise Ripple::PropertyTypeMismatch.new(self, value)
end

Instance Method Details

#to_ripple_index(type) ⇒ Object



80
81
82
83
84
85
86
87
# File 'lib/ripple/core_ext/indexes.rb', line 80

def to_ripple_index(type)
  case type
  when 'bin'
    to_s
  when 'int'
    to_i
  end
end