Class: Pendragon::Padrino::Route
- Defined in:
- lib/pendragon/padrino/route.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#cache ⇒ Object
Returns the value of attribute cache.
-
#cache_expires ⇒ Object
Returns the value of attribute cache_expires.
-
#cache_key ⇒ Object
Returns the value of attribute cache_key.
-
#controller ⇒ Object
Returns the value of attribute controller.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#path_for_generation ⇒ Object
Returns the value of attribute path_for_generation.
-
#use_layout ⇒ Object
Returns the value of attribute use_layout.
-
#user_agent ⇒ Object
Returns the value of attribute user_agent.
Attributes inherited from Route
#block, #capture, #index, #name, #options, #order, #router, #verb
Instance Method Summary collapse
- #after_filters(&block) ⇒ Object
- #before_filters(&block) ⇒ Object
- #call(app, *args) ⇒ Object
- #custom_conditions(&block) ⇒ Object
- #original_path ⇒ Object
- #request_methods ⇒ Object
- #significant_variable_names ⇒ Object
Methods inherited from Route
#arity, #initialize, #match, #matcher, #params, #path, #to
Constructor Details
This class inherits a constructor from Pendragon::Route
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
6 7 8 |
# File 'lib/pendragon/padrino/route.rb', line 6 def action @action end |
#cache ⇒ Object
Returns the value of attribute cache.
6 7 8 |
# File 'lib/pendragon/padrino/route.rb', line 6 def cache @cache end |
#cache_expires ⇒ Object
Returns the value of attribute cache_expires.
6 7 8 |
# File 'lib/pendragon/padrino/route.rb', line 6 def cache_expires @cache_expires end |
#cache_key ⇒ Object
Returns the value of attribute cache_key.
6 7 8 |
# File 'lib/pendragon/padrino/route.rb', line 6 def cache_key @cache_key end |
#controller ⇒ Object
Returns the value of attribute controller.
6 7 8 |
# File 'lib/pendragon/padrino/route.rb', line 6 def controller @controller end |
#parent ⇒ Object
Returns the value of attribute parent.
6 7 8 |
# File 'lib/pendragon/padrino/route.rb', line 6 def parent @parent end |
#path_for_generation ⇒ Object
Returns the value of attribute path_for_generation.
6 7 8 |
# File 'lib/pendragon/padrino/route.rb', line 6 def path_for_generation @path_for_generation end |
#use_layout ⇒ Object
Returns the value of attribute use_layout.
6 7 8 |
# File 'lib/pendragon/padrino/route.rb', line 6 def use_layout @use_layout end |
#user_agent ⇒ Object
Returns the value of attribute user_agent.
6 7 8 |
# File 'lib/pendragon/padrino/route.rb', line 6 def user_agent @user_agent end |
Instance Method Details
#after_filters(&block) ⇒ Object
15 16 17 18 19 |
# File 'lib/pendragon/padrino/route.rb', line 15 def after_filters(&block) @_after_filters ||= [] @_after_filters << block if block_given? @_after_filters end |
#before_filters(&block) ⇒ Object
9 10 11 12 13 |
# File 'lib/pendragon/padrino/route.rb', line 9 def before_filters(&block) @_before_filters ||= [] @_before_filters << block if block_given? @_before_filters end |
#call(app, *args) ⇒ Object
27 28 29 |
# File 'lib/pendragon/padrino/route.rb', line 27 def call(app, *args) @block.call(app, *args) end |
#custom_conditions(&block) ⇒ Object
21 22 23 24 25 |
# File 'lib/pendragon/padrino/route.rb', line 21 def custom_conditions(&block) @_custom_conditions ||= [] @_custom_conditions << block if block_given? @_custom_conditions end |
#original_path ⇒ Object
35 36 37 |
# File 'lib/pendragon/padrino/route.rb', line 35 def original_path @path end |
#request_methods ⇒ Object
31 32 33 |
# File 'lib/pendragon/padrino/route.rb', line 31 def request_methods [verb.to_s.upcase] end |
#significant_variable_names ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/pendragon/padrino/route.rb', line 39 def significant_variable_names @significant_variable_names ||= if @path.is_a?(String) @path.scan(/(^|[^\\])[:\*]([a-zA-Z0-9_]+)/).map{|p| p.last.to_sym} elsif @path.is_a?(Regexp) and @path.respond_to?(:named_captures) @path.named_captures.keys.map(&:to_sym) else [] end end |