Class: Apitizer::Routing::Node::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/apitizer/routing/node/base.rb

Direct Known Subclasses

Collection, Operation, Root

Instance Method Summary collapse

Instance Method Details

#append(child) ⇒ Object



5
6
7
# File 'lib/apitizer/routing/node/base.rb', line 5

def append(child)
  children << child
end

#permit?(action, options) ⇒ Boolean

Returns:

  • (Boolean)


28
29
# File 'lib/apitizer/routing/node/base.rb', line 28

def permit?(action, options)
end

#recognize?(steps) ⇒ Boolean

Returns:

  • (Boolean)


25
26
# File 'lib/apitizer/routing/node/base.rb', line 25

def recognize?(steps)
end

#trace(steps, path = Path.new) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/apitizer/routing/node/base.rb', line 9

def trace(steps, path = Path.new)
  return nil unless recognize?(steps)

  steps, path = steps.clone, path.clone

  walk(steps, path)
  return path if steps.empty?

  children.each do |child|
    branch = child.trace(steps, path)
    return branch if branch
  end

  nil
end