Class: Lutaml::JsonLd::TermDefinition
- Inherits:
-
Object
- Object
- Lutaml::JsonLd::TermDefinition
- Defined in:
- lib/lutaml/jsonld/term_definition.rb
Instance Attribute Summary collapse
-
#container ⇒ Object
readonly
Returns the value of attribute container.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#reverse ⇒ Object
readonly
Returns the value of attribute reverse.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(name:, id: nil, type: nil, container: nil, language: nil, reverse: false) ⇒ TermDefinition
constructor
A new instance of TermDefinition.
- #to_context_hash ⇒ Object
Constructor Details
#initialize(name:, id: nil, type: nil, container: nil, language: nil, reverse: false) ⇒ TermDefinition
Returns a new instance of TermDefinition.
8 9 10 11 12 13 14 15 16 |
# File 'lib/lutaml/jsonld/term_definition.rb', line 8 def initialize(name:, id: nil, type: nil, container: nil, language: nil, reverse: false) @name = name @id = id @type = type @container = container @language = language @reverse = reverse end |
Instance Attribute Details
#container ⇒ Object (readonly)
Returns the value of attribute container.
6 7 8 |
# File 'lib/lutaml/jsonld/term_definition.rb', line 6 def container @container end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/lutaml/jsonld/term_definition.rb', line 6 def id @id end |
#language ⇒ Object (readonly)
Returns the value of attribute language.
6 7 8 |
# File 'lib/lutaml/jsonld/term_definition.rb', line 6 def language @language end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/lutaml/jsonld/term_definition.rb', line 6 def name @name end |
#reverse ⇒ Object (readonly)
Returns the value of attribute reverse.
6 7 8 |
# File 'lib/lutaml/jsonld/term_definition.rb', line 6 def reverse @reverse end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/lutaml/jsonld/term_definition.rb', line 6 def type @type end |
Instance Method Details
#to_context_hash ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/lutaml/jsonld/term_definition.rb', line 18 def to_context_hash if simple_mapping? { @name => @id } else defn = {} defn["@id"] = @id if @id defn["@type"] = @type if @type defn["@container"] = "@#{@container}" if @container defn["@language"] = @language if @language defn["@reverse"] = @reverse if @reverse { @name => defn } end end |