Class: Iglu::SchemaVer

Inherits:
Struct
  • Object
show all
Defined in:
lib/iglu-client/core.rb

Overview

Class holding SchemaVer data

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#additionObject

Returns the value of attribute addition

Returns:

  • (Object)

    the current value of addition



23
24
25
# File 'lib/iglu-client/core.rb', line 23

def addition
  @addition
end

#modelObject

Returns the value of attribute model

Returns:

  • (Object)

    the current value of model



23
24
25
# File 'lib/iglu-client/core.rb', line 23

def model
  @model
end

#revisionObject

Returns the value of attribute revision

Returns:

  • (Object)

    the current value of 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_stringObject

Render as string



26
27
28
# File 'lib/iglu-client/core.rb', line 26

def as_string
  "#{model}-#{revision}-#{addition}"
end