Class: Flame::Router::Route
- Inherits:
-
Object
- Object
- Flame::Router::Route
- Extended by:
- Forwardable
- Defined in:
- lib/flame/router/route.rb
Overview
Class for Route in Router.routes
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
Instance Method Summary collapse
-
#==(other) ⇒ true, false
Method for Routes comparison.
-
#initialize(controller, action) ⇒ Route
constructor
Create a new instance.
- #to_s ⇒ Object
Constructor Details
#initialize(controller, action) ⇒ Route
Create a new instance
19 20 21 22 |
# File 'lib/flame/router/route.rb', line 19 def initialize(controller, action) @controller = controller @action = action end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
12 13 14 |
# File 'lib/flame/router/route.rb', line 12 def action @action end |
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
12 13 14 |
# File 'lib/flame/router/route.rb', line 12 def controller @controller end |
Instance Method Details
#==(other) ⇒ true, false
Method for Routes comparison
27 28 29 30 31 32 33 34 35 |
# File 'lib/flame/router/route.rb', line 27 def ==(other) return false unless other.is_a? self.class i[controller action].reduce(true) do |result, method| result && ( public_send(method) == other.public_send(method) ) end end |
#to_s ⇒ Object
37 38 39 |
# File 'lib/flame/router/route.rb', line 37 def to_s "#{controller}##{action}" end |