Class: Yadtfp::Configuration
- Inherits:
-
Object
- Object
- Yadtfp::Configuration
- Includes:
- Singleton
- Defined in:
- lib/yadtfp/configuration.rb
Instance Attribute Summary collapse
-
#filter ⇒ Object
Returns the value of attribute filter.
-
#outputter ⇒ Object
Returns the value of attribute outputter.
-
#parser ⇒ Object
Returns the value of attribute parser.
Class Method Summary collapse
-
.parse_options(options = {}) ⇒ Object
Parses options, prepares this configuration instance and return the same.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
Initializes
@filter
,@parser
, and@outputter
to their defaults based on the following table:.
Constructor Details
#initialize ⇒ Configuration
Initializes @filter
, @parser
, and @outputter
to their defaults based on the following table:
filter = '*' parser = :ox outputter = :pretty
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/yadtfp/configuration.rb', line 20 def initialize # Path to begin traversing the input XML from @filter = '*' # Parser @parser = :ox # Diff result output formatter @outputter = :pretty end |
Instance Attribute Details
#filter ⇒ Object
Returns the value of attribute filter.
10 11 12 |
# File 'lib/yadtfp/configuration.rb', line 10 def filter @filter end |
#outputter ⇒ Object
Returns the value of attribute outputter.
11 12 13 |
# File 'lib/yadtfp/configuration.rb', line 11 def outputter @outputter end |
#parser ⇒ Object
Returns the value of attribute parser.
11 12 13 |
# File 'lib/yadtfp/configuration.rb', line 11 def parser @parser end |
Class Method Details
.parse_options(options = {}) ⇒ Object
Parses options, prepares this configuration instance and return the same.
Assigns default values to each configuration attributes as defined in the initialize
method.
Raises ArugmentError
if options
is not a hash
70 71 72 73 74 75 76 77 78 79 |
# File 'lib/yadtfp/configuration.rb', line 70 def self.( = {}) raise ArgumentError, "Invalid options hash" if !.is_a?(::Hash) config = self.instance config.filter = [:filter] || '*' config.parser = [:parser] || :ox config.outputter = [:outputter] || :pretty config end |