Class: BBC::A11y::Configuration::DSL
- Inherits:
-
Object
- Object
- BBC::A11y::Configuration::DSL
- Defined in:
- lib/bbc/a11y/configuration.rb
Instance Attribute Summary collapse
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
Instance Method Summary collapse
- #after_all(&block) ⇒ Object
- #before_all(&block) ⇒ Object
- #for_pages_matching(url, &block) ⇒ Object
-
#initialize(config, config_filename = nil) ⇒ DSL
constructor
A new instance of DSL.
- #page(url, &block) ⇒ Object
Constructor Details
#initialize(config, config_filename = nil) ⇒ DSL
Returns a new instance of DSL.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/bbc/a11y/configuration.rb', line 98 def initialize(config, config_filename = nil) @settings = Settings.new @general_page_settings = [] begin if config_filename instance_eval config, config_filename else instance_eval &config end rescue NoMethodError => error method_name = error..scan(/\`(.*)'/)[0][0] raise Configuration::ParseError, "`#{method_name}` is not part of the configuration language", error.backtrace rescue => error raise Configuration::ParseError, error., error.backtrace end @settings = settings.with_pages(apply_general_settings(settings.pages)) end |
Instance Attribute Details
#settings ⇒ Object (readonly)
Returns the value of attribute settings.
96 97 98 |
# File 'lib/bbc/a11y/configuration.rb', line 96 def settings @settings end |
Instance Method Details
#after_all(&block) ⇒ Object
120 121 122 |
# File 'lib/bbc/a11y/configuration.rb', line 120 def after_all(&block) settings.after_all_hooks << block end |
#before_all(&block) ⇒ Object
116 117 118 |
# File 'lib/bbc/a11y/configuration.rb', line 116 def before_all(&block) settings.before_all_hooks << block end |