Class: Chemicalml::Schema::Definition
- Inherits:
-
Object
- Object
- Chemicalml::Schema::Definition
- Defined in:
- lib/chemicalml/schema/definition.rb
Overview
Value object describing one CML schema version. Immutable.
Instance Attribute Summary collapse
-
#ruby_namespace ⇒ Object
readonly
Returns the value of attribute ruby_namespace.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
-
#xml_namespace ⇒ Object
readonly
Returns the value of attribute xml_namespace.
-
#xsd_path ⇒ Object
readonly
Returns the value of attribute xsd_path.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean (also: #==)
- #hash ⇒ Object
-
#initialize(version:, xsd_path:, xml_namespace:, ruby_namespace:) ⇒ Definition
constructor
A new instance of Definition.
- #wire_namespace_constant ⇒ Object
- #xsd_full_path ⇒ Object
Constructor Details
#initialize(version:, xsd_path:, xml_namespace:, ruby_namespace:) ⇒ Definition
Returns a new instance of Definition.
9 10 11 12 13 14 15 |
# File 'lib/chemicalml/schema/definition.rb', line 9 def initialize(version:, xsd_path:, xml_namespace:, ruby_namespace:) @version = version @xsd_path = xsd_path @xml_namespace = xml_namespace @ruby_namespace = ruby_namespace freeze end |
Instance Attribute Details
#ruby_namespace ⇒ Object (readonly)
Returns the value of attribute ruby_namespace.
7 8 9 |
# File 'lib/chemicalml/schema/definition.rb', line 7 def ruby_namespace @ruby_namespace end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
7 8 9 |
# File 'lib/chemicalml/schema/definition.rb', line 7 def version @version end |
#xml_namespace ⇒ Object (readonly)
Returns the value of attribute xml_namespace.
7 8 9 |
# File 'lib/chemicalml/schema/definition.rb', line 7 def xml_namespace @xml_namespace end |
#xsd_path ⇒ Object (readonly)
Returns the value of attribute xsd_path.
7 8 9 |
# File 'lib/chemicalml/schema/definition.rb', line 7 def xsd_path @xsd_path end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
25 26 27 |
# File 'lib/chemicalml/schema/definition.rb', line 25 def eql?(other) other.is_a?(Definition) && version == other.version end |
#hash ⇒ Object
30 31 32 |
# File 'lib/chemicalml/schema/definition.rb', line 30 def hash version.hash end |
#wire_namespace_constant ⇒ Object
21 22 23 |
# File 'lib/chemicalml/schema/definition.rb', line 21 def wire_namespace_constant ruby_namespace.split("::").reduce(Object) { |ns, name| ns.const_get(name) } end |
#xsd_full_path ⇒ Object
17 18 19 |
# File 'lib/chemicalml/schema/definition.rb', line 17 def xsd_full_path File.(xsd_path, project_root) end |