Class: AePageObjects::RakeRouter::Path

Inherits:
String
  • Object
show all
Defined in:
lib/ae_page_objects/core/rake_router.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Path

Returns a new instance of Path.



45
46
47
48
49
50
# File 'lib/ae_page_objects/core/rake_router.rb', line 45

def initialize(value)
  super(value.gsub(/(\/)+/, '/').sub(/\(\.\:format\)$/, ''))
  
  @params = parse_params
  @regex  = generate_regex
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



43
44
45
# File 'lib/ae_page_objects/core/rake_router.rb', line 43

def params
  @params
end

#regexObject (readonly)

Returns the value of attribute regex.



43
44
45
# File 'lib/ae_page_objects/core/rake_router.rb', line 43

def regex
  @regex
end

Instance Method Details

#generate(param_values) ⇒ Object



52
53
54
55
56
57
# File 'lib/ae_page_objects/core/rake_router.rb', line 52

def generate(param_values)
  param_values = HashSymbolizer.new(param_values).symbolize_keys
  @params.values.inject(self) do |path, param|
    param.substitute(path, param_values)
  end
end