Class: URITemplate::Colon::Token::Splat
- Inherits:
-
Variable
- Object
- URITemplate::Colon::Token
- Variable
- URITemplate::Colon::Token::Splat
- Defined in:
- lib/uri_template/colon.rb
Constant Summary
- SPLAT =
'splat'.freeze
Constants included from Token
Instance Attribute Summary (collapse)
-
- (Object) index
readonly
Returns the value of attribute index.
Attributes inherited from Variable
Attributes included from Expression
Instance Method Summary (collapse)
- - (Object) expand(vars)
-
- (Splat) initialize(index)
constructor
A new instance of Splat.
- - (Object) to_r
Methods inherited from Variable
Methods included from Expression
Methods included from Token
#ends_with_slash?, #host?, #scheme?, #size, #starts_with_slash?, #to_s, #variables
Constructor Details
- (Splat) initialize(index)
A new instance of Splat
96 97 98 99 |
# File 'lib/uri_template/colon.rb', line 96 def initialize(index) @index = index super(SPLAT) end |
Instance Attribute Details
- (Object) index (readonly)
Returns the value of attribute index
94 95 96 |
# File 'lib/uri_template/colon.rb', line 94 def index @index end |
Instance Method Details
- (Object) expand(vars)
101 102 103 104 105 106 107 108 |
# File 'lib/uri_template/colon.rb', line 101 def (vars) var = vars[name] if Array === var return Utils.escape_uri(Utils.object_to_param(var[index])) else raise InvalidValue::SplatIsNotAnArray.new(name,var) end end |
- (Object) to_r
110 111 112 |
# File 'lib/uri_template/colon.rb', line 110 def to_r return '(.+?)' end |