class Dill::StringValue

Public Instance Methods

to_date(format = nil) click to toggle source
Calls superclass method
# File lib/dill/widgets/string_value.rb, line 3
def to_date(format = nil)
  format ? Date.strptime(self, format) : super()
end
to_key() click to toggle source
# File lib/dill/widgets/string_value.rb, line 7
def to_key
  fst, rest = first, self[1..-1]
  decamelized = fst + rest.gsub(/([A-Z])/, '_\1')
  underscored = decamelized.gsub(/[\W_]+/, '_')
  stripped = underscored.gsub(/^_|_$/, '')
  downcased = stripped.downcase
  key = downcased.to_sym

  key
end
to_split() click to toggle source
# File lib/dill/widgets/string_value.rb, line 39
def to_split
  split(',').map(&:strip).map { |e| self.class.new(e) }
end
to_usd() click to toggle source
# File lib/dill/widgets/string_value.rb, line 35
def to_usd
  Money.new(self)
end