Class: RubyDuplicates
- Inherits:
-
Object
- Object
- RubyDuplicates
- Defined in:
- lib/ruby_duplicates/cli.rb,
lib/ruby_duplicates/version.rb
Defined Under Namespace
Classes: CLI
Constant Summary collapse
- DEFAULT_IGNORES =
%w[ .git .bundle .burndown-swarm coverage log node_modules tmp vendor/bundle ].freeze
- TOKEN_GROUPS =
{ :@ident => :identifier, :@const => :constant, :@ivar => :ivar, :@cvar => :cvar, :@gvar => :gvar, :@label => :label, :@int => :number, :@float => :number, :@rational => :number, :@imaginary => :number, :@CHAR => :string, :@tstring_content => :string, :@regexp_beg => :regexp, :@regexp_end => :regexp, :@period => :dot, :@op => :operator }.freeze
- VERSION =
"0.1.0"
Instance Method Summary collapse
-
#initialize(options) ⇒ RubyDuplicates
constructor
A new instance of RubyDuplicates.
- #run ⇒ Object
Constructor Details
#initialize(options) ⇒ RubyDuplicates
Returns a new instance of RubyDuplicates.
53 54 55 56 57 58 59 60 61 |
# File 'lib/ruby_duplicates/cli.rb', line 53 def initialize() @threshold = .fetch(:threshold) @min_lines = .fetch(:min_lines) @min_nodes = .fetch(:min_nodes) @max_results = .fetch(:max_results) @format = .fetch(:format) @paths = .fetch(:paths) @ignore_dirs = .fetch(:ignore_dirs) end |
Instance Method Details
#run ⇒ Object
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/ruby_duplicates/cli.rb', line 63 def run candidates = collect_candidates matches = find_matches(candidates) if @format == "json" puts JSON.pretty_generate(json_payload(matches, candidates.length)) else print_text(matches, candidates.length) end end |