Class: AePageObjects::RakeRouter::Path
- Inherits:
-
String
- Object
- String
- AePageObjects::RakeRouter::Path
- Defined in:
- lib/ae_page_objects/core/rake_router.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#regex ⇒ Object
readonly
Returns the value of attribute regex.
Instance Method Summary collapse
- #generate(param_values) ⇒ Object
-
#initialize(value) ⇒ Path
constructor
A new instance of Path.
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
#params ⇒ Object (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 |
#regex ⇒ Object (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 |