Class: Factory
- Inherits:
-
Object
- Object
- Factory
- Includes:
- Helpers
- Defined in:
- lib/gem_velocity/velocitators/factory.rb
Instance Attribute Summary collapse
-
#gem_name ⇒ Object
readonly
Returns the value of attribute gem_name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
-
#versions ⇒ Object
readonly
Returns the value of attribute versions.
Instance Method Summary collapse
-
#initialize(options) ⇒ Factory
constructor
A new instance of Factory.
- #velocitator ⇒ Object
Methods included from Helpers
#compute_day_range_from_start_end, #earliest_for, #latest_for, #remove_trailing_x, #time_format_str, #time_format_str_small
Constructor Details
#initialize(options) ⇒ Factory
Returns a new instance of Factory.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/gem_velocity/velocitators/factory.rb', line 7 def initialize() # one ver passed if [:gem_name] && [:version] @gem_name = [:gem_name] @version = [:version] @type = type_from_version(@version) @versions = self.velocitator.versions elsif [:full_name] @gem_name = name_from_full_name([:full_name]) @version = version_from_full_name([:full_name]) @type = type_from_version(@version) @versions = self.velocitator.versions end end |
Instance Attribute Details
#gem_name ⇒ Object (readonly)
Returns the value of attribute gem_name.
5 6 7 |
# File 'lib/gem_velocity/velocitators/factory.rb', line 5 def gem_name @gem_name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/gem_velocity/velocitators/factory.rb', line 5 def type @type end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
5 6 7 |
# File 'lib/gem_velocity/velocitators/factory.rb', line 5 def version @version end |
#versions ⇒ Object (readonly)
Returns the value of attribute versions.
5 6 7 |
# File 'lib/gem_velocity/velocitators/factory.rb', line 5 def versions @versions end |
Instance Method Details
#velocitator ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/gem_velocity/velocitators/factory.rb', line 23 def velocitator if @type == :aggregated @velocitator ||= AggregatedVelocitator.new(@gem_name, @version) elsif @type == :single @velocitator ||= SingleVelocitator.new(@gem_name, @version) else raise 'no velocitor found to generate!' end end |