Class: RailsParser::Parsers::Rails::ConfigParser
- Inherits:
-
SexpProcessor
- Object
- SexpProcessor
- RailsParser::Parsers::Rails::ConfigParser
- Defined in:
- lib/rails_parser/parsers/rails/config_parser.rb
Overview
Gemfile Parser
The class inspects an application.rb config file and extracts the options
It works like this: parser = ApplicationConfigParser.new parser.parse(“/path/to/application.rb”) parser.application_name #=> “Foobar”
Instance Attribute Summary collapse
-
#config_options ⇒ Object
readonly
Returns the value of attribute config_options.
Instance Method Summary collapse
-
#initialize ⇒ ConfigParser
constructor
A new instance of ConfigParser.
- #process_attrasgn(exp) ⇒ Object
- #process_op_asgn2(exp) ⇒ Object
Constructor Details
#initialize ⇒ ConfigParser
Returns a new instance of ConfigParser.
17 18 19 20 21 |
# File 'lib/rails_parser/parsers/rails/config_parser.rb', line 17 def initialize super self.auto_shift_type = true @config_options = {} end |
Instance Attribute Details
#config_options ⇒ Object (readonly)
Returns the value of attribute config_options.
15 16 17 |
# File 'lib/rails_parser/parsers/rails/config_parser.rb', line 15 def @config_options end |
Instance Method Details
#process_attrasgn(exp) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rails_parser/parsers/rails/config_parser.rb', line 23 def process_attrasgn(exp) object = exp.shift variable = exp.shift value = exp.shift ap object variable = variable[0...-1].to_sym value = value[1][1] @config_options[variable] = value exp end |
#process_op_asgn2(exp) ⇒ Object
36 37 38 |
# File 'lib/rails_parser/parsers/rails/config_parser.rb', line 36 def process_op_asgn2(exp) ap exp end |