Class: VersionedRoutes::VersionedRoutesInfo
- Inherits:
-
Object
- Object
- VersionedRoutes::VersionedRoutesInfo
- Defined in:
- lib/versioned_routes/versioned_routes_info.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
-
#number ⇒ Object
Returns the value of attribute number.
-
#paths ⇒ Object
Returns the value of attribute paths.
Instance Method Summary collapse
- #append(mapping) ⇒ Object
-
#initialize(number) ⇒ VersionedRoutesInfo
constructor
A new instance of VersionedRoutesInfo.
Constructor Details
#initialize(number) ⇒ VersionedRoutesInfo
Returns a new instance of VersionedRoutesInfo.
7 8 9 10 11 |
# File 'lib/versioned_routes/versioned_routes_info.rb', line 7 def initialize(number) @number = number @block = nil @paths = Hash.new { |h, k| h[k] = Set.new } end |
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
5 6 7 |
# File 'lib/versioned_routes/versioned_routes_info.rb', line 5 def block @block end |
#number ⇒ Object
Returns the value of attribute number.
5 6 7 |
# File 'lib/versioned_routes/versioned_routes_info.rb', line 5 def number @number end |
#paths ⇒ Object
Returns the value of attribute paths.
5 6 7 |
# File 'lib/versioned_routes/versioned_routes_info.rb', line 5 def paths @paths end |
Instance Method Details
#append(mapping) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/versioned_routes/versioned_routes_info.rb', line 13 def append(mapping) verb = mapping.make_route(nil, nil).verb regex = mapping.path.to_regexp return false if paths[verb].include? regex paths[verb] << regex true end |