Class: RIESS::Parameter

Inherits:
Object
  • Object
show all
Defined in:
lib/helpers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Parameter

Returns a new instance of Parameter.



7
8
9
10
11
12
13
# File 'lib/helpers.rb', line 7

def initialize(params)
  @params = params
  set_locator_type
  set_locator_value
  set_value
  set_regex
end

Instance Attribute Details

#locator_typeObject (readonly)

Returns the value of attribute locator_type.



5
6
7
# File 'lib/helpers.rb', line 5

def locator_type
  @locator_type
end

#locator_valueObject (readonly)

Returns the value of attribute locator_value.



5
6
7
# File 'lib/helpers.rb', line 5

def locator_value
  @locator_value
end

#regexObject (readonly)

Returns the value of attribute regex.



5
6
7
# File 'lib/helpers.rb', line 5

def regex
  @regex
end

#valueObject (readonly)

Returns the value of attribute value.



5
6
7
# File 'lib/helpers.rb', line 5

def value
  @value
end

Instance Method Details

#parametersObject



47
48
49
# File 'lib/helpers.rb', line 47

def parameters
  @params
end

#set_locator_typeObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/helpers.rb', line 15

def set_locator_type
  if @params.keys.include? :id
    locator_type = :id
  elsif @params.keys.include? :name
    locator_type = :name
  elsif @params.keys.include? :text
    locator_type = :text
  elsif @params.keys.include? :search
    locator_type = :search
  elsif @params.keys.include? :search_path
    locator_type = :search_path
  end
   @locator_type = locator_type
end

#set_locator_valueObject



30
31
32
# File 'lib/helpers.rb', line 30

def set_locator_value
  @locator_value = @params[@locator_type]
end

#set_regexObject



38
39
40
41
42
43
44
45
# File 'lib/helpers.rb', line 38

def set_regex
  if @params.keys.include? :regex
    regex = @params[:regex]
  else
    regex = false
  end
  @regex = regex
end

#set_valueObject



34
35
36
# File 'lib/helpers.rb', line 34

def set_value
  @value = @params[:value]
end