Class: Parklife::RouteSet
- Inherits:
-
Object
- Object
- Parklife::RouteSet
- Includes:
- Enumerable
- Defined in:
- lib/parklife/route_set.rb
Instance Attribute Summary collapse
-
#routes ⇒ Object
readonly
Returns the value of attribute routes.
Instance Method Summary collapse
- #each ⇒ Object
- #get(path, crawl: false) ⇒ Object
-
#initialize ⇒ RouteSet
constructor
A new instance of RouteSet.
- #root(crawl: false) ⇒ Object
- #size ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize ⇒ RouteSet
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
#routes ⇒ Object (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
#each ⇒ Object
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 |
#size ⇒ Object
30 31 32 |
# File 'lib/parklife/route_set.rb', line 30 def size routes.size end |
#to_a ⇒ Object
34 35 36 |
# File 'lib/parklife/route_set.rb', line 34 def to_a routes.to_a end |