123456789_123456789_123456789_123456789_123456789_

Class: Capybara::Selenium::Node::SettableValue

Relationships & Source Files
Inherits: Object
Defined in: lib/capybara/selenium/node.rb

Overview

SettableValue encapsulates time/date field formatting

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(value) ⇒ SettableValue

[ GitHub ]

  
# File 'lib/capybara/selenium/node.rb', line 576

def initialize(value)
  @value = value
end

Instance Attribute Details

#dateable?Boolean (readonly)

[ GitHub ]

  
# File 'lib/capybara/selenium/node.rb', line 584

def dateable?
  !value.is_a?(String) && value.respond_to?(:to_date)
end

#timeable?Boolean (readonly)

[ GitHub ]

  
# File 'lib/capybara/selenium/node.rb', line 592

def timeable?
  !value.is_a?(String) && value.respond_to?(:to_time)
end

#value (readonly)

[ GitHub ]

  
# File 'lib/capybara/selenium/node.rb', line 574

attr_reader :value

Instance Method Details

#to_date_str

[ GitHub ]

  
# File 'lib/capybara/selenium/node.rb', line 588

def to_date_str
  value.to_date.iso8601
end

#to_datetime_str

[ GitHub ]

  
# File 'lib/capybara/selenium/node.rb', line 600

def to_datetime_str
  value.to_time.strftime('%Y-%m-%dT%H:%M')
end

#to_s

[ GitHub ]

  
# File 'lib/capybara/selenium/node.rb', line 580

def to_s
  value.to_s
end

#to_time_str

[ GitHub ]

  
# File 'lib/capybara/selenium/node.rb', line 596

def to_time_str
  value.to_time.strftime('%H:%M')
end