Commit 13eeb969 by Shu Fujita Committed by Andrew W. Lee

Refactor AnnotateModels::Parser (#728)

# Summary * I replaced `#blank?` of ActiveSupport to `#present?` * I moved `AnnotateModels::Parser#commit` after `#parser ` because `#commit` is used after `#parser` in `#parse`.
parent ac907696
...@@ -31,18 +31,18 @@ module Annotate ...@@ -31,18 +31,18 @@ module Annotate
private private
def commit
env.each_pair do |key, value|
ENV[key] = value
end
end
def parser def parser
OptionParser.new do |option_parser| OptionParser.new do |option_parser|
add_options_to_parser(option_parser) add_options_to_parser(option_parser)
end end
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 def add_options_to_parser(option_parser) # rubocop:disable Metrics/MethodLength
has_set_position = {} has_set_position = {}
positions = ANNOTATION_POSITIONS positions = ANNOTATION_POSITIONS
...@@ -184,7 +184,7 @@ module Annotate ...@@ -184,7 +184,7 @@ module Annotate
option_parser.on('-R', '--require path', option_parser.on('-R', '--require path',
"Additional file to require before loading models, may be used multiple times") do |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}" env['require'] + ",#{path}"
else else
path path
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment