Module: ExistDB::Dom::Mapper

Defined in:
lib/existdb/dom/mapper.rb

Overview

Inspired by HappyMapper

Defined Under Namespace

Modules: ClassMethods Classes: Attribute, Boolean, Element, Item

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



8
9
10
11
12
# File 'lib/existdb/dom/mapper.rb', line 8

def self.included(base)
    base.instance_variable_set("@attributes", Hash.new)
    base.instance_variable_set("@elements", Hash.new)
    base.extend ClassMethods
end

Instance Method Details

#initialize(resource) ⇒ Object



14
15
16
17
# File 'lib/existdb/dom/mapper.rb', line 14

def initialize(resource)
    @dom = resource.respond_to?(:dom) ? resource.dom : resource
    @cache = Hash.new
end