Class: RuboCop::Git::Options
- Inherits:
-
Object
- Object
- RuboCop::Git::Options
- Defined in:
- lib/rubocop/git/options.rb
Defined Under Namespace
Classes: Invalid
Constant Summary collapse
- HOUND_DEFAULT_CONFIG_FILE =
File.('../../../../hound.yml', __FILE__)
Instance Attribute Summary collapse
-
#cached ⇒ Object
Returns the value of attribute cached.
-
#config ⇒ Object
Returns the value of attribute config.
-
#hound ⇒ Object
Returns the value of attribute hound.
-
#rubocop ⇒ Object
Returns the value of attribute rubocop.
Instance Method Summary collapse
- #commit_first ⇒ Object
- #commit_last ⇒ Object
- #commits=(commits) ⇒ Object
- #config_file ⇒ Object
-
#initialize(hash_options = nil) ⇒ Options
constructor
A new instance of Options.
Constructor Details
#initialize(hash_options = nil) ⇒ Options
Returns a new instance of Options.
12 13 14 15 16 17 18 19 20 |
# File 'lib/rubocop/git/options.rb', line 12 def initialize( = nil) @config = nil @cached = false @hound = false @rubocop = {} @commits = [] from_hash() if end |
Instance Attribute Details
#cached ⇒ Object
Returns the value of attribute cached.
10 11 12 |
# File 'lib/rubocop/git/options.rb', line 10 def cached @cached end |
#config ⇒ Object
Returns the value of attribute config.
9 10 11 |
# File 'lib/rubocop/git/options.rb', line 9 def config @config end |
#hound ⇒ Object
Returns the value of attribute hound.
10 11 12 |
# File 'lib/rubocop/git/options.rb', line 10 def hound @hound end |
#rubocop ⇒ Object
Returns the value of attribute rubocop.
10 11 12 |
# File 'lib/rubocop/git/options.rb', line 10 def rubocop @rubocop end |
Instance Method Details
#commit_first ⇒ Object
62 63 64 |
# File 'lib/rubocop/git/options.rb', line 62 def commit_first @commits.first end |
#commit_last ⇒ Object
66 67 68 |
# File 'lib/rubocop/git/options.rb', line 66 def commit_last @commits.length == 1 ? false : @commits.last end |
#commits=(commits) ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/rubocop/git/options.rb', line 40 def commits=(commits) unless commits.is_a?(Array) && commits.length <= 2 fail Invalid, "invalid commits: #{commits.inspect}" end if !commits.empty? && cached fail Invalid, 'cached and commit cannot be specified together' end @commits = commits end |
#config_file ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/rubocop/git/options.rb', line 50 def config_file if hound HOUND_DEFAULT_CONFIG_FILE elsif config config elsif File.exist?(RuboCop::ConfigLoader::DOTFILE) RuboCop::ConfigLoader::DOTFILE else RuboCop::ConfigLoader::DEFAULT_FILE end end |