Class: XCDM::Schema::Loader
- Inherits:
-
Object
- Object
- XCDM::Schema::Loader
- Defined in:
- lib/xcdm/schema.rb
Instance Attribute Summary collapse
-
#schemas ⇒ Object
readonly
Returns the value of attribute schemas.
Instance Method Summary collapse
-
#initialize ⇒ Loader
constructor
A new instance of Loader.
- #load_file(file) ⇒ Object
- #schema(version, &block) ⇒ Object
Constructor Details
#initialize ⇒ Loader
Returns a new instance of Loader.
49 50 51 |
# File 'lib/xcdm/schema.rb', line 49 def initialize @schemas = [] end |
Instance Attribute Details
#schemas ⇒ Object (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 |