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

#initialize(xcode_version) ⇒ Loader

Returns a new instance of Loader.



66
67
68
69
# File 'lib/xcdm/schema.rb', line 66

def initialize(xcode_version)
  @xcode_version = xcode_version
  @schemas = []
end

Instance Attribute Details

#schemasObject (readonly)

Returns the value of attribute schemas.



63
64
65
# File 'lib/xcdm/schema.rb', line 63

def schemas
  @schemas
end

#xcode_versionObject (readonly)

Returns the value of attribute xcode_version.



64
65
66
# File 'lib/xcdm/schema.rb', line 64

def xcode_version
  @xcode_version
end

Instance Method Details

#load_file(file) ⇒ Object



77
78
79
80
81
82
# File 'lib/xcdm/schema.rb', line 77

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

#schema(version, options = {}, &block) ⇒ Object



71
72
73
74
75
# File 'lib/xcdm/schema.rb', line 71

def schema(version, options = {}, &block)
  xcv = options[:xcode_version] || xcode_version
  @found_schema = Schema.new(version, xcv).tap { |s| s.instance_eval(&block) }
  @schemas << @found_schema
end