Class: EmberRoutes::Route

Inherits:
Object
  • Object
show all
Defined in:
lib/ember_routes/route.rb,
lib/ember_route_helpers/route.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, opts = {}) ⇒ Route

Returns a new instance of Route.



4
5
6
7
8
# File 'lib/ember_routes/route.rb', line 4

def initialize(name, opts = {})
  @name = name.to_s
  @path = opts.fetch(:path, name)
  @children = []
end

Instance Attribute Details

#childrenObject

Returns the value of attribute children.



3
4
5
# File 'lib/ember_routes/route.rb', line 3

def children
  @children
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/ember_routes/route.rb', line 3

def name
  @name
end

#pathObject

Returns the value of attribute path.



3
4
5
# File 'lib/ember_routes/route.rb', line 3

def path
  @path
end

Instance Method Details

#route(*arguments, &block) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/ember_routes/route.rb', line 9

def route(*arguments, &block)
  p = Route.new(*arguments)
  self.children << p
  if block_given?
    p.instance_eval(&block)
  end
  p
end