Class: JVMArgs::Directive

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arg) ⇒ Directive

Returns a new instance of Directive.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/jvmargs/directive.rb', line 7

def initialize(arg)
  stripped = arg.sub(/^-?D?/, '')

  if stripped =~ /(.*?)=(.*)/
    @key = $1
    @value = $2
  else
    @key = stripped
    @value = true
  end
end

Instance Attribute Details

#keyObject

Returns the value of attribute key.



5
6
7
# File 'lib/jvmargs/directive.rb', line 5

def key
  @key
end

#valueObject

Returns the value of attribute value.



5
6
7
# File 'lib/jvmargs/directive.rb', line 5

def value
  @value
end

Instance Method Details

#to_sObject



19
20
21
22
23
24
25
# File 'lib/jvmargs/directive.rb', line 19

def to_s
  if @value == true
    "-D#{@key}"
  else
    "-D#{@key}=#{@value}"
  end
end