module CIMI::Model::Schema::DSL

The DSL

Requires that the class into which this is included has a add_attributes! method

Public Instance Methods

array(name, opts={}, &block) click to toggle source
# File lib/cimi/models/schema.rb, line 280
def array(name, opts={}, &block)
  add_attributes!([name, opts], Array, &block)
end
hash(name) click to toggle source
# File lib/cimi/models/schema.rb, line 288
def hash(name)
  add_attributes!([name, {}], Hash)
end
href(*args) click to toggle source
# File lib/cimi/models/schema.rb, line 267
def href(*args)
  args.each { |arg| struct(arg) { scalar :href } }
end
scalar(*args) click to toggle source
# File lib/cimi/models/schema.rb, line 276
def scalar(*args)
  add_attributes!(args, Scalar)
end
struct(name, opts={}, &block) click to toggle source
# File lib/cimi/models/schema.rb, line 284
def struct(name, opts={}, &block)
  add_attributes!([name, opts], Struct, &block)
end
text(*args) click to toggle source
# File lib/cimi/models/schema.rb, line 271
def text(*args)
  args.expand_opts!(:text => :nested)
  scalar(*args)
end