Class: Retest::Options

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

Constant Summary collapse

DEFAULT_PARAMS =
{
  all: false,
  diff: nil,
  exts: %w[rb],
  help: false,
  notify: false,
  polling: false,
  rake: false,
  rails: false,
  rspec: false,
  ruby: false,
  version: false,
  watcher: nil,
  command: nil
}.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = []) ⇒ Options

Returns a new instance of Options.



27
28
29
# File 'lib/retest/options.rb', line 27

def initialize(args = [])
  self.args = args
end

Instance Attribute Details

#argsObject

Returns the value of attribute args.



21
22
23
# File 'lib/retest/options.rb', line 21

def args
  @args
end

#paramsObject (readonly)

Returns the value of attribute params.



21
22
23
# File 'lib/retest/options.rb', line 21

def params
  @params
end

Class Method Details

.command(args) ⇒ Object



23
24
25
# File 'lib/retest/options.rb', line 23

def self.command(args)
  new(args).command
end

Instance Method Details

#auto?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/retest/options.rb', line 45

def auto?
  command.nil?
end

#commandObject



41
42
43
# File 'lib/retest/options.rb', line 41

def command
  params[:command]
end

#extensionsObject



69
70
71
# File 'lib/retest/options.rb', line 69

def extensions
  params[:exts]
end

#force_polling?Boolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/retest/options.rb', line 65

def force_polling?
  params[:polling]
end

#full_suite?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/retest/options.rb', line 57

def full_suite?
  params[:all]
end

#helpObject



37
38
39
# File 'lib/retest/options.rb', line 37

def help
  parser.to_s
end

#help?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/retest/options.rb', line 49

def help?
  params[:help]
end

#merge(options = []) ⇒ Object



77
78
79
# File 'lib/retest/options.rb', line 77

def merge(options = [])
  self.class.new(@args.dup.concat(options))
end

#notify?Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/retest/options.rb', line 61

def notify?
  params[:notify]
end

#version?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/retest/options.rb', line 53

def version?
  params[:version]
end

#watcherObject



73
74
75
# File 'lib/retest/options.rb', line 73

def watcher
  params[:watcher] || :installed
end