Class: PryRailsDiffRoutes::RouteWrapper
- Inherits:
-
ActionDispatch::Routing::RouteWrapper
- Object
- ActionDispatch::Routing::RouteWrapper
- PryRailsDiffRoutes::RouteWrapper
show all
- Includes:
- Comparable, Util
- Defined in:
- lib/pry_rails_diff_routes/route_wrapper.rb
Instance Method Summary
collapse
Methods included from Util
arrow_key, bold, bold_green, bold_red, bold_yellow, dim_format, highlight_green, highlight_red, pad_lines
Instance Method Details
#<=>(other) ⇒ Object
14
15
16
17
18
|
# File 'lib/pry_rails_diff_routes/route_wrapper.rb', line 14
def <=>(other)
self.prefix <=> other.prefix &&
self.verb <=> other.verb &&
self.reqs <=> other.reqs
end
|
#display_action ⇒ Object
50
51
52
|
# File 'lib/pry_rails_diff_routes/route_wrapper.rb', line 50
def display_action
"#{arrow_key('Action')} ##{action}"
end
|
#display_constraints ⇒ Object
54
55
56
|
# File 'lib/pry_rails_diff_routes/route_wrapper.rb', line 54
def display_constraints
"#{arrow_key('Constraints')} #{constraints}"
end
|
#display_controller ⇒ Object
46
47
48
|
# File 'lib/pry_rails_diff_routes/route_wrapper.rb', line 46
def display_controller
"#{arrow_key('Controller')} #{controller.camelize}Controller"
end
|
#display_prefix ⇒ Object
42
43
44
|
# File 'lib/pry_rails_diff_routes/route_wrapper.rb', line 42
def display_prefix
"#{arrow_key('Prefix')} #{prefix}"
end
|
#display_verb_and_path ⇒ Object
38
39
40
|
# File 'lib/pry_rails_diff_routes/route_wrapper.rb', line 38
def display_verb_and_path
"#{bold verb.ljust(6, ' ')} #{dim_format path}"
end
|
#eql?(other) ⇒ Boolean
24
25
26
|
# File 'lib/pry_rails_diff_routes/route_wrapper.rb', line 24
def eql?(other)
self == other
end
|
#hash ⇒ Object
20
21
22
|
# File 'lib/pry_rails_diff_routes/route_wrapper.rb', line 20
def hash
[self.prefix, self.verb, self.reqs].hash
end
|
#to_s ⇒ Object
28
29
30
31
32
33
34
35
36
|
# File 'lib/pry_rails_diff_routes/route_wrapper.rb', line 28
def to_s
pad_lines <<~ROUTE, 1
#{display_verb_and_path}
#{display_prefix}
#{display_controller}
#{display_action}
#{display_constraints}
ROUTE
end
|