Class: Bananajour::Bonjour::Repository

Inherits:
Object
  • Object
show all
Defined in:
lib/bananajour/bonjour/repository.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, uri, person) ⇒ Repository

Returns a new instance of Repository.



5
6
7
# File 'lib/bananajour/bonjour/repository.rb', line 5

def initialize(name, uri, person)
  @name, @uri, @person = name, uri, person
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/bananajour/bonjour/repository.rb', line 3

def name
  @name
end

#personObject

Returns the value of attribute person.



3
4
5
# File 'lib/bananajour/bonjour/repository.rb', line 3

def person
  @person
end

#uriObject

Returns the value of attribute uri.



3
4
5
# File 'lib/bananajour/bonjour/repository.rb', line 3

def uri
  @uri
end

Instance Method Details

#==(other) ⇒ Object



13
14
15
# File 'lib/bananajour/bonjour/repository.rb', line 13

def ==(other)
  self.uri == other.uri
end

#hashObject



17
18
19
# File 'lib/bananajour/bonjour/repository.rb', line 17

def hash
  to_hash.hash
end

#html_idObject



9
10
11
# File 'lib/bananajour/bonjour/repository.rb', line 9

def html_id
  Bananajour::Repository.html_id(name)
end

#json_uriObject



21
22
23
# File 'lib/bananajour/bonjour/repository.rb', line 21

def json_uri
  "#{person.uri}#{name}.json"
end

#to_hashObject



29
30
31
32
33
34
35
36
37
# File 'lib/bananajour/bonjour/repository.rb', line 29

def to_hash
  {
    "name" => name,
    "uri" => uri,
    "json_uri" => json_uri,
    "web_uri" => web_uri,
    "person" => person.to_hash
  }
end

#web_uriObject



25
26
27
# File 'lib/bananajour/bonjour/repository.rb', line 25

def web_uri
  "#{person.uri}##{html_id}"
end