Class: JVMArgs::Unstable
- Inherits:
-
Object
- Object
- JVMArgs::Unstable
- Defined in:
- lib/jvmargs/unstable.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(arg) ⇒ Unstable
constructor
A new instance of Unstable.
- #to_s ⇒ Object
Constructor Details
#initialize(arg) ⇒ Unstable
Returns a new instance of Unstable.
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/jvmargs/unstable.rb', line 6 def initialize(arg) stripped = arg.sub(/^-?XX:/, '') # check it if a boolean option stripped =~ /(\+|-)(.*)/ if !$1.nil? @key = $2 @value = $1 == '+' ? true : false else stripped =~ /(.*)=(.*)/ @key = $1 @value = $2 end end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
4 5 6 |
# File 'lib/jvmargs/unstable.rb', line 4 def key @key end |
#value ⇒ Object
Returns the value of attribute value.
4 5 6 |
# File 'lib/jvmargs/unstable.rb', line 4 def value @value end |
Instance Method Details
#to_s ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/jvmargs/unstable.rb', line 20 def to_s if @value.class == TrueClass or @value.class == FalseClass symbol = @value ? '+' : '-' "-XX:#{symbol}#{@key}" else "-XX:#{@key}=#{@value}" end end |