Class: JVMArgs::Unstable

Inherits:
Object
  • Object
show all
Defined in:
lib/jvmargs/unstable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#keyObject

Returns the value of attribute key.



4
5
6
# File 'lib/jvmargs/unstable.rb', line 4

def key
  @key
end

#valueObject

Returns the value of attribute value.



4
5
6
# File 'lib/jvmargs/unstable.rb', line 4

def value
  @value
end

Instance Method Details

#to_sObject



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