Class: BEL::Annotation::AnnotationDefinition
- Inherits:
-
Object
- Object
- BEL::Annotation::AnnotationDefinition
- Includes:
- Enumerable
- Defined in:
- lib/bel/annotation.rb
Instance Attribute Summary collapse
-
#keyword ⇒ Object
readonly
Returns the value of attribute keyword.
-
#rdf_uri ⇒ Object
readonly
Returns the value of attribute rdf_uri.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #[](value) ⇒ Object
- #each ⇒ Object
- #hash ⇒ Object
-
#initialize(keyword, url, rdf_uri = DEFAULT_URI) ⇒ AnnotationDefinition
constructor
A new instance of AnnotationDefinition.
- #to_bel ⇒ Object
- #to_s ⇒ Object
- #values ⇒ Object
Constructor Details
#initialize(keyword, url, rdf_uri = DEFAULT_URI) ⇒ AnnotationDefinition
Returns a new instance of AnnotationDefinition.
54 55 56 57 58 59 |
# File 'lib/bel/annotation.rb', line 54 def initialize(keyword, url, rdf_uri = DEFAULT_URI) @keyword = keyword @url = url @rdf_uri = rdf_uri @values = nil end |
Instance Attribute Details
#keyword ⇒ Object (readonly)
Returns the value of attribute keyword.
50 51 52 |
# File 'lib/bel/annotation.rb', line 50 def keyword @keyword end |
#rdf_uri ⇒ Object (readonly)
Returns the value of attribute rdf_uri.
52 53 54 |
# File 'lib/bel/annotation.rb', line 52 def rdf_uri @rdf_uri end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
51 52 53 |
# File 'lib/bel/annotation.rb', line 51 def url @url end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
91 92 93 94 |
# File 'lib/bel/annotation.rb', line 91 def ==(other) return false if other == nil @keyword == other.keyword && @url == other.url end |
#[](value) ⇒ Object
68 69 70 71 72 73 |
# File 'lib/bel/annotation.rb', line 68 def [](value) return nil unless value reload(@url) if not @values sym = value.to_sym Language::Annotation.new(keyword, sym) end |
#each ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/bel/annotation.rb', line 75 def each reload(@url) if not @values if block_given? annotation_keyword = keyword @values.each do |val, _| yield Language::Annotation.new(annotation_keyword, val.to_sym) end else to_enum(:each) end end |
#hash ⇒ Object
87 88 89 |
# File 'lib/bel/annotation.rb', line 87 def hash [@keyword, @url].hash end |
#to_bel ⇒ Object
102 103 104 |
# File 'lib/bel/annotation.rb', line 102 def to_bel %Q{DEFINE ANNOTATION #@keyword AS URL "#@url"} end |
#to_s ⇒ Object
98 99 100 |
# File 'lib/bel/annotation.rb', line 98 def to_s @keyword.to_s end |
#values ⇒ Object
61 62 63 64 65 66 |
# File 'lib/bel/annotation.rb', line 61 def values unless @values reload(@url) end @values end |