Module: URITemplate::Literal

Includes:
Token
Included in:
Colon::Token::Static, RFC6570::Literal
Defined in:
lib/uri_template/literal.rb

Overview

A module which all literal tokens should include.

Constant Summary collapse

SLASH =
?/

Constants included from Token

Token::EMPTY_ARRAY

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Token

#host?, #scheme?, #variables

Instance Attribute Details

#stringObject (readonly) Also known as: to_s

Returns the value of attribute string.



31
32
33
# File 'lib/uri_template/literal.rb', line 31

def string
  @string
end

Instance Method Details

#ends_with_slash?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/uri_template/literal.rb', line 57

def ends_with_slash?
  string[-1] == SLASH
end

#expand(_) ⇒ Object



45
46
47
# File 'lib/uri_template/literal.rb', line 45

def expand(_)
  return string
end

#expand_partial(_) ⇒ Object



49
50
51
# File 'lib/uri_template/literal.rb', line 49

def expand_partial(_)
  return [self]
end

#expression?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/uri_template/literal.rb', line 37

def expression?
  false
end

#literal?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/uri_template/literal.rb', line 33

def literal?
  true
end

#sizeObject



41
42
43
# File 'lib/uri_template/literal.rb', line 41

def size
  0
end

#starts_with_slash?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/uri_template/literal.rb', line 53

def starts_with_slash?
  string[0] == SLASH
end