Class: Lutaml::Rdf::MemberRule
- Inherits:
-
Object
- Object
- Lutaml::Rdf::MemberRule
- Defined in:
- lib/glossarist/rdf/ext/member_rule_ext.rb
Instance Attribute Summary collapse
-
#attr_name ⇒ Object
readonly
Returns the value of attribute attr_name.
-
#inline ⇒ Object
readonly
Returns the value of attribute inline.
-
#link ⇒ Object
readonly
Returns the value of attribute link.
Instance Method Summary collapse
-
#initialize(attr_name, inline: true, link: nil) ⇒ MemberRule
constructor
A new instance of MemberRule.
- #link_predicate_for(member, mapping) ⇒ Object
Constructor Details
#initialize(attr_name, inline: true, link: nil) ⇒ MemberRule
Returns a new instance of MemberRule.
15 16 17 18 19 |
# File 'lib/glossarist/rdf/ext/member_rule_ext.rb', line 15 def initialize(attr_name, inline: true, link: nil) @attr_name = attr_name.to_sym @inline = inline @link = link end |
Instance Attribute Details
#attr_name ⇒ Object (readonly)
Returns the value of attribute attr_name.
13 14 15 |
# File 'lib/glossarist/rdf/ext/member_rule_ext.rb', line 13 def attr_name @attr_name end |
#inline ⇒ Object (readonly)
Returns the value of attribute inline.
13 14 15 |
# File 'lib/glossarist/rdf/ext/member_rule_ext.rb', line 13 def inline @inline end |
#link ⇒ Object (readonly)
Returns the value of attribute link.
13 14 15 |
# File 'lib/glossarist/rdf/ext/member_rule_ext.rb', line 13 def link @link end |
Instance Method Details
#link_predicate_for(member, mapping) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/glossarist/rdf/ext/member_rule_ext.rb', line 21 def link_predicate_for(member, mapping) return nil unless @link case @link when String mapping.namespace_set.resolve_compact_iri(@link) when Proc uri = @link.call(member) uri.include?(":") ? mapping.namespace_set.resolve_compact_iri(uri) : uri end end |