class Amber::RoutePath

Attributes

callback[R]
child[R]
method[R]

Public Class Methods

new(method = "GET", callback = nil) click to toggle source
# File lib/amber/route_path.rb, line 4
def initialize(method = "GET", callback = nil)
  @child = {}
  @method = method
  @callback = callback
end

Public Instance Methods

add_child(path, child) click to toggle source
# File lib/amber/route_path.rb, line 18
def add_child(path, child)
  if child.is_a? Amber::RoutePath
    @child[path] = child
    return
  end

  raise ArgumentError, "Child should be a route item"
end
callback=(callback) click to toggle source
# File lib/amber/route_path.rb, line 31
def callback=(callback)
  if callback.is_a? Proc
    @callback = callback
    return
  end

  raise ArgumentError, "Callback should be a proc"
end
can_call?() click to toggle source
# File lib/amber/route_path.rb, line 14
def can_call?
  @callback != nil
end
has_child?() click to toggle source
# File lib/amber/route_path.rb, line 10
def has_child?
  !@child.empty?
end
method=(method) click to toggle source
# File lib/amber/route_path.rb, line 27
def method=(method)
  @method = method
end