Class: SimpleService::ArgumentValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_service/argument_validator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ ArgumentValidator



6
7
8
9
10
# File 'lib/simple_service/argument_validator.rb', line 6

def initialize(opts)
  @context  = opts[:context]
  @expects  = opts[:expects]
  @commands = opts[:commands]
end

Instance Attribute Details

#commandsObject

Returns the value of attribute commands.



4
5
6
# File 'lib/simple_service/argument_validator.rb', line 4

def commands
  @commands
end

#contextObject

Returns the value of attribute context.



4
5
6
# File 'lib/simple_service/argument_validator.rb', line 4

def context
  @context
end

#expectsObject

Returns the value of attribute expects.



4
5
6
# File 'lib/simple_service/argument_validator.rb', line 4

def expects
  @expects
end

Instance Method Details

#executeObject



12
13
14
15
16
17
# File 'lib/simple_service/argument_validator.rb', line 12

def execute
  validate_expected_arguments
  validate_commands_not_empty
  validate_commands_properly_inherit
  true
end