Class: Halibut::LinkRelation

Inherits:
Object
  • Object
show all
Defined in:
lib/halibut/link_relation.rb

Overview

Domain object that represents a Relation

spec spec spec.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ LinkRelation

Returns a new instance of LinkRelation.



9
10
11
12
13
# File 'lib/halibut/link_relation.rb', line 9

def initialize(name)
  splits = name.to_s.split(":")

  splits.size < 2 ? @name = splits.first : (@curie, @name = splits)
end

Instance Attribute Details

#curieObject

Returns the value of attribute curie.



7
8
9
# File 'lib/halibut/link_relation.rb', line 7

def curie
  @curie
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/halibut/link_relation.rb', line 7

def name
  @name
end

Instance Method Details

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/halibut/link_relation.rb', line 15

def eql?(other)
  hash == other.hash
end

#hashObject



19
20
21
# File 'lib/halibut/link_relation.rb', line 19

def hash
  instance_variables.hash
end

#to_sObject



23
24
25
# File 'lib/halibut/link_relation.rb', line 23

def to_s
  @curie and "#{@curie}:#{@name}" or @name
end