Class: HecksPackager::Args

Inherits:
Object
  • Object
show all
Defined in:
lib/packager/args.rb

Overview

represents the args passed in

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command_args) ⇒ Args

Returns a new instance of Args.



6
7
8
9
10
# File 'lib/packager/args.rb', line 6

def initialize(command_args)
  @domain_module = command_args[0]
  @method        = command_args[1]
  @data          = command_args[2]
end

Instance Attribute Details

#methodObject (readonly)

Returns the value of attribute method.



4
5
6
# File 'lib/packager/args.rb', line 4

def method
  @method
end

Instance Method Details

#dataObject



16
17
18
19
20
21
22
23
24
# File 'lib/packager/args.rb', line 16

def data
  json = JSON.parse(@data, symbolize_names: true)

  if(@method == 'delete')
    return json[:id]
  else
    json
  end
end

#domain_moduleObject



12
13
14
# File 'lib/packager/args.rb', line 12

def domain_module
  @domain_module.to_sym
end