Class: Rack::Mount::Utils::Capture
- Inherits:
-
Array
- Object
- Array
- Rack::Mount::Utils::Capture
- Defined in:
- lib/rack/mount/utils.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#optional ⇒ Object
(also: #optional?)
readonly
Returns the value of attribute optional.
Instance Method Summary collapse
- #==(obj) ⇒ Object
- #freeze ⇒ Object
-
#initialize(*args) ⇒ Capture
constructor
A new instance of Capture.
- #named? ⇒ Boolean
- #optionalize! ⇒ Object
Constructor Details
#initialize(*args) ⇒ Capture
Returns a new instance of Capture.
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/rack/mount/utils.rb', line 47 def initialize(*args) = args.last.is_a?(Hash) ? args.pop : {} @name = .delete(:name) @name = @name.to_s if @name @optional = .delete(:optional) || false super(args) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
44 45 46 |
# File 'lib/rack/mount/utils.rb', line 44 def name @name end |
#optional ⇒ Object (readonly) Also known as: optional?
Returns the value of attribute optional.
44 45 46 |
# File 'lib/rack/mount/utils.rb', line 44 def optional @optional end |
Instance Method Details
#==(obj) ⇒ Object
58 59 60 |
# File 'lib/rack/mount/utils.rb', line 58 def ==(obj) @name == obj.name && @optional == obj.optional && super end |
#freeze ⇒ Object
71 72 73 74 |
# File 'lib/rack/mount/utils.rb', line 71 def freeze each { |e| e.freeze } super end |
#named? ⇒ Boolean
67 68 69 |
# File 'lib/rack/mount/utils.rb', line 67 def named? name && name != '' end |
#optionalize! ⇒ Object
62 63 64 65 |
# File 'lib/rack/mount/utils.rb', line 62 def optionalize! @optional = true self end |