Class: Hashira::CLI::Options

Inherits:
Data
  • Object
show all
Defined in:
lib/hashira/cli/options.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**attributes) ⇒ Options

Returns a new instance of Options.



12
13
14
15
# File 'lib/hashira/cli/options.rb', line 12

def initialize(**attributes)
  super
  Needs.check(self)
end

Instance Attribute Details

#baselineObject (readonly)

Returns the value of attribute baseline

Returns:

  • (Object)

    the current value of baseline



6
7
8
# File 'lib/hashira/cli/options.rb', line 6

def baseline
  @baseline
end

#compactObject (readonly)

Returns the value of attribute compact

Returns:

  • (Object)

    the current value of compact



6
7
8
# File 'lib/hashira/cli/options.rb', line 6

def compact
  @compact
end

#directoriesObject (readonly)

Returns the value of attribute directories

Returns:

  • (Object)

    the current value of directories



6
7
8
# File 'lib/hashira/cli/options.rb', line 6

def directories
  @directories
end

#fail_onObject (readonly)

Returns the value of attribute fail_on

Returns:

  • (Object)

    the current value of fail_on



6
7
8
# File 'lib/hashira/cli/options.rb', line 6

def fail_on
  @fail_on
end

#modeObject (readonly)

Returns the value of attribute mode

Returns:

  • (Object)

    the current value of mode



6
7
8
# File 'lib/hashira/cli/options.rb', line 6

def mode
  @mode
end

#packagingObject (readonly)

Returns the value of attribute packaging

Returns:

  • (Object)

    the current value of packaging



6
7
8
# File 'lib/hashira/cli/options.rb', line 6

def packaging
  @packaging
end

#skipObject (readonly)

Returns the value of attribute skip

Returns:

  • (Object)

    the current value of skip



6
7
8
# File 'lib/hashira/cli/options.rb', line 6

def skip
  @skip
end

#topObject (readonly)

Returns the value of attribute top

Returns:

  • (Object)

    the current value of top



6
7
8
# File 'lib/hashira/cli/options.rb', line 6

def top
  @top
end

Class Method Details

.page(mode) ⇒ Object



10
# File 'lib/hashira/cli/options.rb', line 10

def self.page(mode) = new(**PAGE, mode:)

.parse(argv) ⇒ Object



8
# File 'lib/hashira/cli/options.rb', line 8

def self.parse(argv) = CommandLine.new(argv).options

Instance Method Details

#analyzersObject



25
# File 'lib/hashira/cli/options.rb', line 25

def analyzers = Hashira::Pipeline::ANALYZERS - skip

#pipelineObject



17
18
19
20
21
22
23
# File 'lib/hashira/cli/options.rb', line 17

def pipeline
  chosen = Hashira::Project.detect(directories)
  told = Hashira::Report::Notices.new
  told.scanning(chosen.files.size)
  told.rails if directories.empty? && File.exist?("config/application.rb")
  Hashira::Pipeline.new(chosen, enabled: analyzers, packaging:)
end