Class: Iglu::SchemaKey
- Inherits:
-
Struct
- Object
- Struct
- Iglu::SchemaKey
- Defined in:
- lib/iglu-client/core.rb
Overview
Class holding Schema metadata
Instance Attribute Summary collapse
-
#format ⇒ Object
Returns the value of attribute format.
-
#name ⇒ Object
Returns the value of attribute name.
-
#vendor ⇒ Object
Returns the value of attribute vendor.
-
#version ⇒ Object
Returns the value of attribute version.
Class Method Summary collapse
-
.parse_key(key) ⇒ Object
Construct SchemaKey from URI.
Instance Method Summary collapse
-
#as_path ⇒ Object
Render as plain path.
-
#as_uri ⇒ Object
Render as Iglu URI (with ‘iglu:`).
Instance Attribute Details
#format ⇒ Object
Returns the value of attribute format
43 44 45 |
# File 'lib/iglu-client/core.rb', line 43 def format @format end |
#name ⇒ Object
Returns the value of attribute name
43 44 45 |
# File 'lib/iglu-client/core.rb', line 43 def name @name end |
#vendor ⇒ Object
Returns the value of attribute vendor
43 44 45 |
# File 'lib/iglu-client/core.rb', line 43 def vendor @vendor end |
#version ⇒ Object
Returns the value of attribute version
43 44 45 |
# File 'lib/iglu-client/core.rb', line 43 def version @version end |
Class Method Details
.parse_key(key) ⇒ Object
Construct SchemaKey from URI
56 57 58 59 60 61 62 63 64 |
# File 'lib/iglu-client/core.rb', line 56 def self.parse_key(key) vendor, name, format, version = key.scan(URI_REGEX).flatten if vendor.nil? or name.nil? or format.nil? or version.nil? raise IgluError.new "Schema key [#{key}] is not valid Iglu URI" else schema_ver = SchemaVer.parse_schemaver(version) SchemaKey.new vendor, name, format, schema_ver end end |
Instance Method Details
#as_path ⇒ Object
Render as plain path
51 52 53 |
# File 'lib/iglu-client/core.rb', line 51 def as_path "#{vendor}/#{name}/#{format}/#{version.as_string}" end |
#as_uri ⇒ Object
Render as Iglu URI (with ‘iglu:`)
46 47 48 |
# File 'lib/iglu-client/core.rb', line 46 def as_uri "iglu:#{as_path}" end |