class Capybara::UI::StringValue

Public Instance Methods

to_date(format = nil) click to toggle source
Calls superclass method
# File lib/capybara/ui/widgets/string_value.rb, line 4
def to_date(format = nil)
  if format
    Date.strptime(self, format)
  elsif defined?(super)
    super()
  else
    Date.parse(self)
  end
end
to_key() click to toggle source
# File lib/capybara/ui/widgets/string_value.rb, line 14
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/capybara/ui/widgets/string_value.rb, line 46
def to_split
  split(',').map(&:strip).map { |e| self.class.new(e) }
end
to_usd() click to toggle source
# File lib/capybara/ui/widgets/string_value.rb, line 42
def to_usd
  Money.new(self)
end