Class: RokuBuilder::Options

Inherits:
Hash
  • Object
show all
Defined in:
lib/roku_builder/options.rb

Instance Method Summary collapse

Methods inherited from Hash

#deep_dup, #deep_merge, #deep_merge!, #deep_merger

Constructor Details

#initialize(options: nil) ⇒ Options

Returns a new instance of Options.



5
6
7
8
9
10
# File 'lib/roku_builder/options.rb', line 5

def initialize(options: nil)
  @logger = Logger.instance
  setup_plugin_commands
  options ||= parse
  merge!(options)
end

Instance Method Details

#commandObject



18
19
20
# File 'lib/roku_builder/options.rb', line 18

def command
  (keys & commands).first
end

#device_command?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/roku_builder/options.rb', line 30

def device_command?
  device_commands.include?(command)
end

#exclude_command?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/roku_builder/options.rb', line 22

def exclude_command?
  exclude_commands.include?(command)
end

#has_source?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/roku_builder/options.rb', line 38

def has_source?
  !(keys & sources).empty?
end

#keyed_command?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/roku_builder/options.rb', line 34

def keyed_command?
  keyed_commands.include?(command)
end

#source_command?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/roku_builder/options.rb', line 26

def source_command?
  source_commands.include?(command)
end

#validateObject



12
13
14
15
16
# File 'lib/roku_builder/options.rb', line 12

def validate
  validate_commands
  validate_sources
  validate_deprivated
end