Module: Jets::Router::Scope::Macros
- Extended by:
- ActiveSupport::Concern
- Included in:
- Jets::Router::Scope
- Defined in:
- lib/jets/router/scope.rb
Constant Summary collapse
- OPTION_ACCESSORS =
Set.new
Instance Method Summary collapse
-
#[](key) ⇒ Object
Allow [] and []= notation.
- #[]=(key, value) ⇒ Object
Instance Method Details
#[](key) ⇒ Object
Allow [] and []= notation. Though Jets does not use this internally. This is what Rails ActionDispatch::Routing::Mapper::Scope does. Helps with compatibility in case plugins use this notation.
33 34 35 36 37 38 39 |
# File 'lib/jets/router/scope.rb', line 33 def [](key) if OPTION_ACCESSORS.include?(key) send(key) else raise NoMethodError, "undefined method `#{key}' for #{self}" end end |
#[]=(key, value) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/jets/router/scope.rb', line 41 def []=(key, value) if OPTION_ACCESSORS.include?(key) send("#{key}=", value) else raise NoMethodError, "undefined method `#{key}' for #{self}" end end |