Class: Pessimize::Gem
- Inherits:
-
Object
- Object
- Pessimize::Gem
- Defined in:
- lib/pessimize/gem.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Gem
constructor
A new instance of Gem.
- #to_code ⇒ Object
Constructor Details
#initialize(*args) ⇒ Gem
Returns a new instance of Gem.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/pessimize/gem.rb', line 6 def initialize(*args) @name = args.shift while arg = args.shift if arg.is_a? Hash @options = arg else @version = arg end end end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/pessimize/gem.rb', line 3 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/pessimize/gem.rb', line 3 def @options end |
#version ⇒ Object
Returns the value of attribute version.
3 4 5 |
# File 'lib/pessimize/gem.rb', line 3 def version @version end |
Instance Method Details
#to_code ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/pessimize/gem.rb', line 17 def to_code s = "" s << %Q{gem "#{name}"} s << %Q{, "#{version}"} if version s << %Q{, #{.inspect}} if s end |