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

EMPTY_ARRAY =
[].freeze

Instance Method Summary (collapse)

Instance Method Details

- (Boolean) ends_with_slash?

Returns:

  • (Boolean)


42
43
44
# File 'lib/uri_template/token.rb', line 42

def ends_with_slash?
  false
end

- (Object) expand(variables)

This method is abstract.


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

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

- (Boolean) host?

Returns:

  • (Boolean)


50
51
52
# File 'lib/uri_template/token.rb', line 50

def host?
  false
end

- (Boolean) scheme?

Returns:

  • (Boolean)


46
47
48
# File 'lib/uri_template/token.rb', line 46

def scheme?
  false
end

- (Object) size

Number of variables in this token



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

def size
  variables.size
end

- (Boolean) starts_with_slash?

Returns:

  • (Boolean)


38
39
40
# File 'lib/uri_template/token.rb', line 38

def starts_with_slash?
  false
end

- (Object) to_s

This method is abstract.


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

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

- (Array<String>) variables

The variable names used in this token.

Returns:

  • (Array<String>)


29
30
31
# File 'lib/uri_template/token.rb', line 29

def variables
  EMPTY_ARRAY
end