Class: Qor::Test::Gem
- Inherits:
-
Object
- Object
- Qor::Test::Gem
- Defined in:
- lib/qor_test/gem.rb
Instance Attribute Summary collapse
-
#gem_option ⇒ Object
Returns the value of attribute gem_option.
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(node, gem_option = nil) ⇒ Gem
constructor
A new instance of Gem.
- #to_s ⇒ Object
Constructor Details
#initialize(node, gem_option = nil) ⇒ Gem
Returns a new instance of Gem.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/qor_test/gem.rb', line 6 def initialize(node, gem_option=nil) self.name = node.name.to_s self.gem_option = gem_option [:git, :path, :platforms].map do |type| if node.parent.is_node?(type) self. = {type => node.parent.value}.merge(node.parent.) end end end |
Instance Attribute Details
#gem_option ⇒ Object
Returns the value of attribute gem_option.
4 5 6 |
# File 'lib/qor_test/gem.rb', line 4 def gem_option @gem_option end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/qor_test/gem.rb', line 4 def name @name end |
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/qor_test/gem.rb', line 4 def @options end |
Class Method Details
Instance Method Details
#to_s ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/qor_test/gem.rb', line 17 def to_s if gem_option.is_a?(Array) && gem_option.length > 0 %{gem "#{name}", #{gem_option.map(&:inspect).join(", ")}} elsif !gem_option.nil? && !gem_option.is_a?(Array) %{gem "#{name}", #{gem_option.inspect}} elsif .is_a?(Hash) %{gem "#{name}", #{.inspect}} else %{gem "#{name}"} end end |