Sha256: 5e330d49939bdc6a6a0f87f0d4f67bfa8f53c4ed6f85e10105041c3d54e2eee8

Contents?: true

Size: 583 Bytes

Versions: 5

Compression:

Stored size: 583 Bytes

Contents

class VirtualDateElement
  attr_reader :root_element, :attribute_name

  def initialize(root_element, attribute_name)
    @root_element = root_element
    @attribute_name = attribute_name
  end

  def set(date)
    year_element.set(date.year)
    month_element.set(date.month)
    day_element.set(date.day)
  end

  def year_element
    token_element('1i')
  end

  def month_element
    token_element('2i')
  end

  def day_element
    token_element('3i')
  end

  private

  def token_element(token)
    root_element.find :input_for_field, "#{attribute_name}(#{token})"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tedium-0.0.5 lib/tedium/virtual_date_element.rb
tedium-0.0.4 lib/tedium/virtual_date_element.rb
tedium-0.0.3 lib/tedium/virtual_date_element.rb
tedium-0.0.2 lib/tedium/virtual_date_element.rb
tedium-0.0.1 lib/tedium/virtual_date_element.rb