Class: Annotate::Parser
- Inherits:
-
Object
- Object
- Annotate::Parser
- Defined in:
- lib/annotate/parser.rb
Overview
Class for handling command line arguments
Constant Summary collapse
- DEFAULT_OPTIONS =
{ target_action: :do_annotations, exit: false }.freeze
- ANNOTATION_POSITIONS =
%w[before top after bottom].freeze
- FILE_TYPE_POSITIONS =
%w[position_in_class position_in_factory position_in_fixture position_in_test position_in_routes position_in_serializer].freeze
- EXCLUSION_LIST =
%w[tests fixtures factories serializers].freeze
- FORMAT_TYPES =
%w[bare rdoc yard markdown].freeze
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
-
.parse(args, env = {}) ⇒ Object
rubocop:disable Metrics/ClassLength.
Instance Method Summary collapse
-
#initialize(args, env) ⇒ Parser
constructor
A new instance of Parser.
- #parse ⇒ Object
Constructor Details
#initialize(args, env) ⇒ Parser
Returns a new instance of Parser.
22 23 24 25 26 |
# File 'lib/annotate/parser.rb', line 22 def initialize(args, env) @args = args @options = DEFAULT_OPTIONS.dup @env = env end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
10 11 12 |
# File 'lib/annotate/parser.rb', line 10 def args @args end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
10 11 12 |
# File 'lib/annotate/parser.rb', line 10 def env @env end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/annotate/parser.rb', line 10 def @options end |
Class Method Details
.parse(args, env = {}) ⇒ Object
rubocop:disable Metrics/ClassLength
6 7 8 |
# File 'lib/annotate/parser.rb', line 6 def self.parse(args, env = {}) new(args, env).parse end |
Instance Method Details
#parse ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/annotate/parser.rb', line 28 def parse # To split up because right now this method parses and commits parser.parse!(args) commit end |