Class: StrongRoutes::Config
- Inherits:
-
Object
- Object
- StrongRoutes::Config
- Defined in:
- lib/strong_routes/config.rb
Instance Attribute Summary collapse
-
#allowed_routes ⇒ Object
Returns the value of attribute allowed_routes.
-
#content ⇒ Object
Returns the value of attribute content.
-
#content_type ⇒ Object
Returns the value of attribute content_type.
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#insert_after ⇒ Object
Returns the value of attribute insert_after.
-
#insert_before ⇒ Object
Returns the value of attribute insert_before.
-
#route_matchers ⇒ Object
readonly
Returns the value of attribute route_matchers.
- #status ⇒ Object
Instance Method Summary collapse
- #enabled? ⇒ Boolean
- #headers ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #insert_after? ⇒ Boolean
- #insert_before? ⇒ Boolean
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
14 15 16 17 18 |
# File 'lib/strong_routes/config.rb', line 14 def initialize @allowed_routes = Set.new @enabled = true @route_matchers = [] end |
Instance Attribute Details
#allowed_routes ⇒ Object
Returns the value of attribute allowed_routes.
11 12 13 |
# File 'lib/strong_routes/config.rb', line 11 def allowed_routes @allowed_routes end |
#content ⇒ Object
Returns the value of attribute content.
5 6 7 |
# File 'lib/strong_routes/config.rb', line 5 def content @content end |
#content_type ⇒ Object
Returns the value of attribute content_type.
5 6 7 |
# File 'lib/strong_routes/config.rb', line 5 def content_type @content_type end |
#enabled ⇒ Object
Returns the value of attribute enabled.
5 6 7 |
# File 'lib/strong_routes/config.rb', line 5 def enabled @enabled end |
#insert_after ⇒ Object
Returns the value of attribute insert_after.
5 6 7 |
# File 'lib/strong_routes/config.rb', line 5 def insert_after @insert_after end |
#insert_before ⇒ Object
Returns the value of attribute insert_before.
5 6 7 |
# File 'lib/strong_routes/config.rb', line 5 def insert_before @insert_before end |
#route_matchers ⇒ Object (readonly)
Returns the value of attribute route_matchers.
11 12 13 |
# File 'lib/strong_routes/config.rb', line 11 def route_matchers @route_matchers end |
#status ⇒ Object
46 47 48 |
# File 'lib/strong_routes/config.rb', line 46 def status @status ||= 404 end |
Instance Method Details
#enabled? ⇒ Boolean
26 27 28 |
# File 'lib/strong_routes/config.rb', line 26 def enabled? !!enabled end |
#headers ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/strong_routes/config.rb', line 30 def headers if content.present? {Rack::CONTENT_TYPE => content_type || "text/plain"} else {} end end |
#insert_after? ⇒ Boolean
38 39 40 |
# File 'lib/strong_routes/config.rb', line 38 def insert_after? !!insert_after end |
#insert_before? ⇒ Boolean
42 43 44 |
# File 'lib/strong_routes/config.rb', line 42 def insert_before? !!insert_before end |