Class: Loca::URL::Parser
- Inherits:
-
Object
- Object
- Loca::URL::Parser
- Defined in:
- lib/loca/url/parser.rb
Instance Method Summary collapse
- #all_attrs ⇒ Object
-
#initialize(url) ⇒ Parser
constructor
A new instance of Parser.
- #parse ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(url) ⇒ Parser
Returns a new instance of Parser.
4 5 6 7 8 |
# File 'lib/loca/url/parser.rb', line 4 def initialize(url) @url = url @uri = Addressable::URI.parse(@url) @segments = @uri.path.split("/").reject(&:empty?) end |
Instance Method Details
#all_attrs ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/loca/url/parser.rb', line 21 def all_attrs { branch_name: @branch_name, pull: { num: @pull_num, url: @pull_url }, remote: { name: @remote_name, url: @remote_url } } end |
#parse ⇒ Object
14 15 16 17 18 19 |
# File 'lib/loca/url/parser.rb', line 14 def parse validate parse_attrs set_other_attrs all_attrs end |
#to_s ⇒ Object
10 11 12 |
# File 'lib/loca/url/parser.rb', line 10 def to_s @url end |