Class: Mangdown::Properties
- Inherits:
-
Object
- Object
- Mangdown::Properties
- Defined in:
- lib/mangdown/properties.rb
Instance Method Summary collapse
-
#initialize(uri, site = nil, doc = nil) ⇒ Properties
constructor
A new instance of Properties.
Constructor Details
#initialize(uri, site = nil, doc = nil) ⇒ Properties
Returns a new instance of Properties.
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/mangdown/properties.rb', line 4 def initialize(uri, site = nil, doc = nil) adapter_class = ADAPTERS.find { |adapter| (site||uri).to_s =~ /#{adapter.to_s.split('::').last.downcase}/ } if adapter_class @adapter = adapter_class.new(uri, doc) else raise ArgumentError, "Bad Site: No Properties Specified for Site <#{uri}>" end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object (private)
17 18 19 20 21 22 23 |
# File 'lib/mangdown/properties.rb', line 17 def method_missing(method, *args, &block) if @adapter.respond_to?(method) @adapter.__send__(method, *args, &block) else super end end |