Class: Parklife::RouteSet

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/parklife/route_set.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRouteSet

Returns a new instance of RouteSet.



12
13
14
# File 'lib/parklife/route_set.rb', line 12

def initialize
  @routes = Set.new
end

Instance Attribute Details

#routesObject (readonly)

Returns the value of attribute routes.



10
11
12
# File 'lib/parklife/route_set.rb', line 10

def routes
  @routes
end

Instance Method Details

#eachObject



16
17
18
19
20
# File 'lib/parklife/route_set.rb', line 16

def each
  routes.each do |path|
    yield path
  end
end

#get(path, crawl: false) ⇒ Object



22
23
24
# File 'lib/parklife/route_set.rb', line 22

def get(path, crawl: false)
  routes << Route.new(path, crawl: crawl)
end

#root(crawl: false) ⇒ Object



26
27
28
# File 'lib/parklife/route_set.rb', line 26

def root(crawl: false)
  get('/', crawl: crawl)
end

#sizeObject



30
31
32
# File 'lib/parklife/route_set.rb', line 30

def size
  routes.size
end

#to_aObject



34
35
36
# File 'lib/parklife/route_set.rb', line 34

def to_a
  routes.to_a
end