Class: URITemplate::RFC6570::Literal

Inherits:
Token
  • Object
show all
Includes:
Literal
Defined in:
lib/uri_template/rfc6570.rb

Constant Summary

Constants included from Literal

Literal::SLASH

Constants included from Token

Token::EMPTY_ARRAY

Instance Attribute Summary

Attributes included from Literal

#string

Instance Method Summary collapse

Methods included from Literal

#ends_with_slash?, #expand, #expand_partial, #expression?, #literal?, #size, #starts_with_slash?

Methods included from Token

#ends_with_slash?, #expand, #expand_partial, #host?, #scheme?, #size, #starts_with_slash?, #variables

Constructor Details

#initialize(string) ⇒ Literal

Returns a new instance of Literal.



171
172
173
# File 'lib/uri_template/rfc6570.rb', line 171

def initialize(string)
  @string = string
end

Instance Method Details

#levelObject



175
176
177
# File 'lib/uri_template/rfc6570.rb', line 175

def level
  1
end

#to_r_source(*_) ⇒ Object



179
180
181
# File 'lib/uri_template/rfc6570.rb', line 179

def to_r_source(*_)
  Regexp.escape(@string)
end

#to_sObject



183
184
185
# File 'lib/uri_template/rfc6570.rb', line 183

def to_s
  @string
end