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 collapse
- SPLAT =
'splat'.freeze
Constants included from Token
Instance Attribute Summary collapse
-
#index ⇒ Object
readonly
Returns the value of attribute index.
Attributes inherited from Variable
Attributes included from Expression
Instance Method Summary collapse
- #expand(vars) ⇒ Object
-
#initialize(index) ⇒ Splat
constructor
A new instance of Splat.
- #to_r ⇒ Object
Methods inherited from Variable
Methods included from Expression
Methods included from Token
#ends_with_slash?, #expand_partial, #host?, #scheme?, #size, #starts_with_slash?, #to_s, #variables
Constructor Details
Instance Attribute Details
#index ⇒ Object (readonly)
Returns the value of attribute index.
100 101 102 |
# File 'lib/uri_template/colon.rb', line 100 def index @index end |
Instance Method Details
#expand(vars) ⇒ Object
107 108 109 110 111 112 113 114 |
# File 'lib/uri_template/colon.rb', line 107 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 |
#to_r ⇒ Object
116 117 118 |
# File 'lib/uri_template/colon.rb', line 116 def to_r return '(.+?)' end |