Skip to content

Commit

Permalink
Refactor AnnotateModels::Parser (ctran#728)
Browse files Browse the repository at this point in the history
# Summary

*   I replaced `#blank?` of ActiveSupport to `#present?`
*   I moved `AnnotateModels::Parser#commit` after `#parser ` because `#commit` is used after `#parser` in `#parse`.
  • Loading branch information
nard-tech authored and vfonic committed May 8, 2020
1 parent 8e46ed4 commit 266afe0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/annotate/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ def parse

private

def commit
env.each_pair do |key, value|
ENV[key] = value
end
end

def parser
OptionParser.new do |option_parser|
add_options_to_parser(option_parser)
end
end

def commit
env.each_pair do |key, value|
ENV[key] = value
end
end

def add_options_to_parser(option_parser) # rubocop:disable Metrics/MethodLength
has_set_position = {}
positions = ANNOTATION_POSITIONS
Expand Down Expand Up @@ -184,7 +184,7 @@ def add_options_to_parser(option_parser) # rubocop:disable Metrics/MethodLength

option_parser.on('-R', '--require path',
"Additional file to require before loading models, may be used multiple times") do |path|
env['require'] = if !env['require'].blank?
env['require'] = if env['require'].present?
env['require'] + ",#{path}"
else
path
Expand Down

0 comments on commit 266afe0

Please sign in to comment.