Class: Lutaml::Rdf::MemberRule
- Inherits:
-
Object
- Object
- Lutaml::Rdf::MemberRule
- Defined in:
- lib/lutaml/rdf/member_rule.rb
Instance Attribute Summary collapse
-
#attr_name ⇒ Object
readonly
Returns the value of attribute attr_name.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
-
#predicate_name ⇒ Object
readonly
Returns the value of attribute predicate_name.
Instance Method Summary collapse
-
#initialize(attr_name, predicate_name: nil, namespace: nil) ⇒ MemberRule
constructor
A new instance of MemberRule.
- #linked? ⇒ Boolean
- #linked_predicate_uri ⇒ Object
Constructor Details
#initialize(attr_name, predicate_name: nil, namespace: nil) ⇒ MemberRule
Returns a new instance of MemberRule.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/lutaml/rdf/member_rule.rb', line 8 def initialize(attr_name, predicate_name: nil, namespace: nil) if predicate_name && !namespace raise ArgumentError, "namespace is required when predicate_name is provided" end @attr_name = attr_name.to_sym @predicate_name = predicate_name @namespace = namespace end |
Instance Attribute Details
#attr_name ⇒ Object (readonly)
Returns the value of attribute attr_name.
6 7 8 |
# File 'lib/lutaml/rdf/member_rule.rb', line 6 def attr_name @attr_name end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
6 7 8 |
# File 'lib/lutaml/rdf/member_rule.rb', line 6 def namespace @namespace end |
#predicate_name ⇒ Object (readonly)
Returns the value of attribute predicate_name.
6 7 8 |
# File 'lib/lutaml/rdf/member_rule.rb', line 6 def predicate_name @predicate_name end |
Instance Method Details
#linked? ⇒ Boolean
19 20 21 |
# File 'lib/lutaml/rdf/member_rule.rb', line 19 def linked? !!@predicate_name end |
#linked_predicate_uri ⇒ Object
23 24 25 26 27 |
# File 'lib/lutaml/rdf/member_rule.rb', line 23 def linked_predicate_uri return nil unless linked? @namespace[@predicate_name] end |