Class: YamlBot::CLIBot

Inherits:
Object
  • Object
show all
Defined in:
lib/yaml_bot/cli_bot.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ CLIBot

Returns a new instance of CLIBot.



9
10
11
12
13
# File 'lib/yaml_bot/cli_bot.rb', line 9

def initialize(opts = {})
  @options = opts
  @rules_bot = RulesBot.new
  @validation_bot = ValidationBot.new
end

Instance Attribute Details

#logger_botObject

Returns the value of attribute logger_bot.



7
8
9
# File 'lib/yaml_bot/cli_bot.rb', line 7

def logger_bot
  @logger_bot
end

#optionsObject

Returns the value of attribute options.



7
8
9
# File 'lib/yaml_bot/cli_bot.rb', line 7

def options
  @options
end

#rules_botObject

Returns the value of attribute rules_bot.



7
8
9
# File 'lib/yaml_bot/cli_bot.rb', line 7

def rules_bot
  @rules_bot
end

#validation_botObject

Returns the value of attribute validation_bot.



7
8
9
# File 'lib/yaml_bot/cli_bot.rb', line 7

def validation_bot
  @validation_bot
end

Instance Method Details

#runObject



15
16
17
18
19
20
21
22
23
# File 'lib/yaml_bot/cli_bot.rb', line 15

def run
  check_cli_options
  load_rules
  load_yaml
  validate_rules
  scan_yaml
  print_results
  @validation_bot.violations.zero? ? 0 : 1
end