Class: DataPackage::Schema

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

Instance Method Summary collapse

Methods included from AttrHelper::Serialization

#to_hash, #to_json

Methods included from AttrHelper::Base

#attr_missing?, #attr_present?, #attr_required?, #attributes, included, #missing_attributes, #optional_attributes, #required_attributes, #write_attribute, #write_attributes

Constructor Details

#initialize(attrs = {}) ⇒ Schema

Returns a new instance of Schema.



9
10
11
12
13
# File 'lib/data_package/schema.rb', line 9

def initialize(attrs = {})
  @fields ||= []
  
  super(attrs)
end

Instance Method Details

#fields=(json) ⇒ Object



15
16
17
# File 'lib/data_package/schema.rb', line 15

def fields=(json)
  @fields = json.collect{|f| Field.new(f)}
end