Class: XCDM::Schema::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/xcdm/schema.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLoader

Returns a new instance of Loader.



49
50
51
# File 'lib/xcdm/schema.rb', line 49

def initialize
  @schemas = []
end

Instance Attribute Details

#schemasObject (readonly)

Returns the value of attribute schemas.



47
48
49
# File 'lib/xcdm/schema.rb', line 47

def schemas
  @schemas
end

Instance Method Details

#load_file(file) ⇒ Object



58
59
60
61
62
63
# File 'lib/xcdm/schema.rb', line 58

def load_file(file)
  File.open(file) do |ff|
    instance_eval(ff.read, file)
  end
  @found_schema
end

#schema(version, &block) ⇒ Object



53
54
55
56
# File 'lib/xcdm/schema.rb', line 53

def schema(version, &block)
  @found_schema = Schema.new(version).tap { |s| s.instance_eval(&block) }
  @schemas << @found_schema 
end