Module: QAT::Web::Configuration

Included in:
Elements::Selector, Finders
Defined in:
lib/qat/web/configuration.rb

Overview

Since:

  • 1.0.0

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.last_accessHash

Returns the last value accessed from configuration in all QAT::Web::Configuration instances

Returns:

  • (Hash)

Since:

  • 1.0.0



31
32
33
# File 'lib/qat/web/configuration.rb', line 31

def last_access
  @last_access
end

.last_access=(value) ⇒ Hash

Sets the last value accessed from configuration in all QAT::Web::Configuration instances

Parameters:

  • value (Hash)

    value from configuration to save

Options Hash (value):

  • :type (String)

    Selector type (Capybara.default_selector)

  • :value (String)

    Selector value

Returns:

  • (Hash)

See Also:

  • Capybara::Queries::SelectorQuery

Since:

  • 1.0.0



41
42
43
# File 'lib/qat/web/configuration.rb', line 41

def last_access=(value)
  @last_access=value
end

Instance Method Details

#last_accessHash

Returns the last value accessed from configuration

Returns:

  • (Hash)

Since:

  • 1.0.0



24
25
26
# File 'lib/qat/web/configuration.rb', line 24

def last_access
  @last_access
end

#parse_configuration(config) ⇒ Array

Parses the configuration value into a usable Capybara selector

Parameters:

  • config (Hash)

    value from configuration to save

Options Hash (config):

  • :type (String)

    Selector type (Capybara.default_selector)

  • :value (String)

    Selector value

Returns:

  • (Array)

See Also:

  • Capybara::Queries::SelectorQuery

Since:

  • 1.0.0



13
14
15
16
17
18
19
20
# File 'lib/qat/web/configuration.rb', line 13

def parse_configuration config
  Configuration.last_access = config
  @last_access              = config
  type                      = config.fetch :type, Capybara.default_selector
  value                     = config.fetch :value
  opts                      = config.select { |key, _| Capybara::Queries::SelectorQuery::VALID_KEYS.include? key }
  return type.to_sym, value, opts.to_hash.symbolize_keys
end