Module: URITemplate::Literal

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

Overview

A module which all literal tokens should include.

Constant Summary

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

- (Object) string (readonly) Also known as: to_s

Returns the value of attribute string



25
26
27
# File 'lib/uri_template/literal.rb', line 25

def string
  @string
end

Instance Method Details

- (Boolean) ends_with_slash?

Returns:

  • (Boolean)


47
48
49
# File 'lib/uri_template/literal.rb', line 47

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

- (Object) expand(_)



39
40
41
# File 'lib/uri_template/literal.rb', line 39

def expand(_)
  return string
end

- (Boolean) expression?

Returns:

  • (Boolean)


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

def expression?
  false
end

- (Boolean) literal?

Returns:

  • (Boolean)


27
28
29
# File 'lib/uri_template/literal.rb', line 27

def literal?
  true
end

- (Object) size



35
36
37
# File 'lib/uri_template/literal.rb', line 35

def size
  0
end

- (Boolean) starts_with_slash?

Returns:

  • (Boolean)


43
44
45
# File 'lib/uri_template/literal.rb', line 43

def starts_with_slash?
  string[0] == SLASH
end