Class: Utopia::Controller::Rewrite::Rule
- Inherits:
-
Object
- Object
- Utopia::Controller::Rewrite::Rule
- Defined in:
- lib/utopia/controller/rewrite.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#block ⇒ Object
readonly
Returns the value of attribute block.
Instance Method Summary collapse
- #apply_match_to_context(match_data, context) ⇒ Object
- #freeze ⇒ Object
-
#initialize(arguments, block) ⇒ Rule
constructor
A new instance of Rule.
Constructor Details
#initialize(arguments, block) ⇒ Rule
Returns a new instance of Rule.
32 33 34 35 36 37 |
# File 'lib/utopia/controller/rewrite.rb', line 32 def initialize(arguments, block) @arguments = arguments @block = block self.freeze end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
46 47 48 |
# File 'lib/utopia/controller/rewrite.rb', line 46 def arguments @arguments end |
#block ⇒ Object (readonly)
Returns the value of attribute block.
47 48 49 |
# File 'lib/utopia/controller/rewrite.rb', line 47 def block @block end |
Instance Method Details
#apply_match_to_context(match_data, context) ⇒ Object
49 50 51 52 53 |
# File 'lib/utopia/controller/rewrite.rb', line 49 def apply_match_to_context(match_data, context) match_data.names.each do |name| context.instance_variable_set("@#{name}", match_data[name]) end end |
#freeze ⇒ Object
39 40 41 42 43 44 |
# File 'lib/utopia/controller/rewrite.rb', line 39 def freeze @arguments.freeze @block.freeze super end |