Class: Pronto::ConfigFile
- Inherits:
-
Object
- Object
- Pronto::ConfigFile
- Defined in:
- lib/pronto/config_file.rb
Constant Summary collapse
- DEFAULT_MESSAGE_FORMAT =
'%{msg}'.freeze
- DEFAULT_WARNINGS_PER_REVIEW =
30
- EMPTY =
{ 'all' => { 'exclude' => [], 'include' => [] }, 'github' => { 'slug' => nil, 'access_token' => nil, 'api_endpoint' => 'https://api.github.com/', 'web_endpoint' => 'https://github.com/', 'review_type' => 'request_changes' }, 'gitlab' => { 'slug' => nil, 'api_private_token' => nil, 'api_endpoint' => 'https://gitlab.com/api/v4' }, 'bitbucket' => { 'slug' => nil, 'username' => nil, 'password' => nil, 'api_endpoint' => nil, 'auto_approve' => false, 'web_endpoint' => 'https://bitbucket.org/' }, 'text' => { 'format' => '%{color_location} %{color_level}: %{msg}' }, 'default_commit' => 'master', 'runners' => [], 'formatters' => [], 'max_warnings' => nil, 'warnings_per_review' => DEFAULT_WARNINGS_PER_REVIEW, 'verbose' => false, 'format' => DEFAULT_MESSAGE_FORMAT }.freeze
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(path = ENV.fetch('PRONTO_CONFIG_FILE', '.pronto.yml')) ⇒ ConfigFile
constructor
A new instance of ConfigFile.
- #to_h ⇒ Object
Constructor Details
#initialize(path = ENV.fetch('PRONTO_CONFIG_FILE', '.pronto.yml')) ⇒ ConfigFile
Returns a new instance of ConfigFile.
45 46 47 |
# File 'lib/pronto/config_file.rb', line 45 def initialize(path = ENV.fetch('PRONTO_CONFIG_FILE', '.pronto.yml')) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
43 44 45 |
# File 'lib/pronto/config_file.rb', line 43 def path @path end |
Instance Method Details
#to_h ⇒ Object
49 50 51 52 |
# File 'lib/pronto/config_file.rb', line 49 def to_h hash = File.exist?(@path) ? YAML.load_file(@path) : {} deep_merge(hash) end |