Module: URITemplate::Token Abstract

Included in:
Expression, Literal
Defined in:
lib/uri_template/token.rb

Overview

This module is abstract.

This should make it possible to do basic analysis independently from the concrete type. Usually the submodules Literal and Expression are used.

Constant Summary collapse

EMPTY_ARRAY =
[].freeze

Instance Method Summary collapse

Instance Method Details

#ends_with_slash?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/uri_template/token.rb', line 48

def ends_with_slash?
  false
end

#expand(variables) ⇒ Object

This method is abstract.


61
62
63
# File 'lib/uri_template/token.rb', line 61

def expand(variables)
  raise "Please implement #expand(variables) on #{self.class.inspect}."
end

#expand_partial(variables) ⇒ Object

This method is abstract.


66
67
68
# File 'lib/uri_template/token.rb', line 66

def expand_partial(variables)
  raise "Please implement #expand_partial(variables) on #{self.class.inspect}."
end

#host?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/uri_template/token.rb', line 56

def host?
  false
end

#scheme?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/uri_template/token.rb', line 52

def scheme?
  false
end

#sizeObject

Number of variables in this token



40
41
42
# File 'lib/uri_template/token.rb', line 40

def size
  variables.size
end

#starts_with_slash?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/uri_template/token.rb', line 44

def starts_with_slash?
  false
end

#to_sObject

This method is abstract.


71
72
73
# File 'lib/uri_template/token.rb', line 71

def to_s
  raise "Please implement #to_s on #{self.class.inspect}."
end

#variablesArray<String>

The variable names used in this token.

Returns:

  • (Array<String>)


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

def variables
  EMPTY_ARRAY
end