Class: Goose::Address
- Inherits:
-
Object
- Object
- Goose::Address
- Includes:
- Enumerable
- Defined in:
- lib/goose/address.rb
Instance Method Summary collapse
- #at?(head_name) ⇒ Boolean
- #each(&block) ⇒ Object
-
#initialize(head, *tail) ⇒ Address
constructor
A new instance of Address.
- #resolve(url) ⇒ Object
Constructor Details
#initialize(head, *tail) ⇒ Address
Returns a new instance of Address.
6 7 8 9 10 11 12 13 |
# File 'lib/goose/address.rb', line 6 def initialize(head, *tail) if head.is_a?(Array) @head = head else @head_name = head end @tail = tail end |
Instance Method Details
#at?(head_name) ⇒ Boolean
15 16 17 18 19 20 21 |
# File 'lib/goose/address.rb', line 15 def at?(head_name) if resolved? @head.first == head_name else @head_name == head_name end end |
#each(&block) ⇒ Object
23 24 25 |
# File 'lib/goose/address.rb', line 23 def each(&block) list.each(&block) end |
#resolve(url) ⇒ Object
27 28 29 30 31 |
# File 'lib/goose/address.rb', line 27 def resolve(url) unless resolved? @head = [@head_name, url] end end |