Class: Iglu::SchemaVer
- Inherits:
-
Struct
- Object
- Struct
- Iglu::SchemaVer
- Defined in:
- lib/iglu-client/core.rb
Overview
Class holding SchemaVer data
Instance Attribute Summary collapse
-
#addition ⇒ Object
Returns the value of attribute addition.
-
#model ⇒ Object
Returns the value of attribute model.
-
#revision ⇒ Object
Returns the value of attribute revision.
Class Method Summary collapse
-
.parse_schemaver(version) ⇒ Object
Construct SchemaVer from string.
Instance Method Summary collapse
-
#as_string ⇒ Object
Render as string.
Instance Attribute Details
#addition ⇒ Object
Returns the value of attribute addition
23 24 25 |
# File 'lib/iglu-client/core.rb', line 23 def addition @addition end |
#model ⇒ Object
Returns the value of attribute model
23 24 25 |
# File 'lib/iglu-client/core.rb', line 23 def model @model end |
#revision ⇒ Object
Returns the value of attribute revision
23 24 25 |
# File 'lib/iglu-client/core.rb', line 23 def revision @revision end |
Class Method Details
.parse_schemaver(version) ⇒ Object
Construct SchemaVer from string
31 32 33 34 35 36 37 38 |
# File 'lib/iglu-client/core.rb', line 31 def self.parse_schemaver(version) model, revision, addition = version.scan(SCHEMAVER_REGEX).flatten if model.nil? or revision.nil? or addition.nil? raise IgluError.new "Schema version #{version} is not a valid Iglu SchemaVer" else SchemaVer.new model.to_i, revision.to_i, addition.to_i end end |
Instance Method Details
#as_string ⇒ Object
Render as string
26 27 28 |
# File 'lib/iglu-client/core.rb', line 26 def as_string "#{model}-#{revision}-#{addition}" end |