Class: Spout::Helpers::Semantic
- Inherits:
-
Object
- Object
- Spout::Helpers::Semantic
- Defined in:
- lib/spout/helpers/semantic.rb
Overview
Finds compatible versions
Instance Attribute Summary collapse
-
#data_dictionary_version ⇒ Object
Returns the value of attribute data_dictionary_version.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(version, version_strings) ⇒ Semantic
constructor
A new instance of Semantic.
- #major ⇒ Object
- #minor ⇒ Object
- #selected_folder ⇒ Object
- #tiny ⇒ Object
- #valid_versions ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(version, version_strings) ⇒ Semantic
Returns a new instance of Semantic.
41 42 43 44 |
# File 'lib/spout/helpers/semantic.rb', line 41 def initialize(version, version_strings) @data_dictionary_version = Spout::Helpers::Version.new(version) @versions = version_strings.collect { |vs| Spout::Helpers::Version.new(vs) }.sort_by(&:rank) end |
Instance Attribute Details
#data_dictionary_version ⇒ Object
Returns the value of attribute data_dictionary_version.
39 40 41 |
# File 'lib/spout/helpers/semantic.rb', line 39 def data_dictionary_version @data_dictionary_version end |
Instance Method Details
#build ⇒ Object
74 75 76 |
# File 'lib/spout/helpers/semantic.rb', line 74 def build @data_dictionary_version.build end |
#major ⇒ Object
62 63 64 |
# File 'lib/spout/helpers/semantic.rb', line 62 def major @data_dictionary_version.major end |
#minor ⇒ Object
66 67 68 |
# File 'lib/spout/helpers/semantic.rb', line 66 def minor @data_dictionary_version.minor end |
#selected_folder ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/spout/helpers/semantic.rb', line 50 def selected_folder if valid_versions.size == 0 || valid_versions.collect(&:string).include?(version) version else valid_versions.collect(&:string).last end end |
#tiny ⇒ Object
70 71 72 |
# File 'lib/spout/helpers/semantic.rb', line 70 def tiny @data_dictionary_version.tiny end |
#valid_versions ⇒ Object
46 47 48 |
# File 'lib/spout/helpers/semantic.rb', line 46 def valid_versions @versions.select { |v| v.major == major && v.minor == minor } end |
#version ⇒ Object
58 59 60 |
# File 'lib/spout/helpers/semantic.rb', line 58 def version @data_dictionary_version.string end |