Class: OsRule

Inherits:
Rule
  • Object
show all
Defined in:
lib/wonko_the_sane/rules.rb

Instance Attribute Summary collapse

Attributes inherited from Rule

#action

Instance Method Summary collapse

Methods inherited from Rule

allowed_on_side, from_json

Constructor Details

#initialize(action, os, os_version = nil, os_arch = nil) ⇒ OsRule

Returns a new instance of OsRule.



41
42
43
44
45
46
# File 'lib/wonko_the_sane/rules.rb', line 41

def initialize(action, os, os_version = nil, os_arch = nil)
  super(action)
  @os = os
  @os_version = os_version
  @os_arch = os_arch
end

Instance Attribute Details

#osObject

Returns the value of attribute os.



37
38
39
# File 'lib/wonko_the_sane/rules.rb', line 37

def os
  @os
end

#os_archObject

Returns the value of attribute os_arch.



39
40
41
# File 'lib/wonko_the_sane/rules.rb', line 39

def os_arch
  @os_arch
end

#os_versionObject

Returns the value of attribute os_version.



38
39
40
# File 'lib/wonko_the_sane/rules.rb', line 38

def os_version
  @os_version
end

Instance Method Details

#to_jsonObject



48
49
50
51
52
53
54
# File 'lib/wonko_the_sane/rules.rb', line 48

def to_json
  obj = super
  obj[:os] = { name: @os }
  obj[:os][:version] = @os_version if @os_version
  obj[:os][:arch] = @os_arch if @os_arch
  obj
end