Class: Onsi::Includes
- Inherits:
-
Object
- Object
- Onsi::Includes
- Defined in:
- lib/onsi/includes.rb
Instance Attribute Summary collapse
-
#included ⇒ Object
readonly
Returns the value of attribute included.
Instance Method Summary collapse
-
#initialize(included) ⇒ Includes
constructor
A new instance of Includes.
- #load_included ⇒ Object
- #method_missing(name, *args, &block) ⇒ Object
Constructor Details
#initialize(included) ⇒ Includes
Returns a new instance of Includes.
5 6 7 |
# File 'lib/onsi/includes.rb', line 5 def initialize(included) @included = parse_included(included) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/onsi/includes.rb', line 9 def method_missing(name, *args, &block) if name =~ /\Afetch_(.*)/ add_fetch_method(name.to_s.gsub(/\Afetch_/, ''), *args, &block) else super end end |
Instance Attribute Details
#included ⇒ Object (readonly)
Returns the value of attribute included.
3 4 5 |
# File 'lib/onsi/includes.rb', line 3 def included @included end |
Instance Method Details
#load_included ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/onsi/includes.rb', line 17 def load_included @load_included ||= {}.tap do |root| included.each do |name| fetcher = fetch_methods[name] next if fetcher.nil? results = fetcher.call root[name] = results end end end |