Sha256: dc3a0ff1d07c9f6eda03b6016465e8e2758d4a2dfea90209e2df7864da651c54

Contents?: true

Size: 998 Bytes

Versions: 2

Compression:

Stored size: 998 Bytes

Contents

#! /usr/bin/env ruby

begin
  # dev mode
  require File.dirname(__FILE__) + '/lib/dslize'
rescue
  require 'dslize'
end

module DSLize::Methods
  include DSLize::Methods::Base
  
  def self.my_first_custom_method(attr, args = {})
    args[:type] = :custom
    DSLize.current_object[attr] = args
  end
  
  def self.my_second_custom_method
    DSLize.current_object['baz'] = true
  end
  
end

module DSLize::Definition
  
  class City
    string :name
    integer :population, :default => 42
  end
  
  class Country
    string :name, :default => 'France'
    
    has_many City, :as => :cities
    
    has_one City, :as => :capital
  end
  
  class World
    root
    
    has_many Country
    
    my_first_custom_method :foo, :default => 'bar'
    
    my_second_custom_method
  end
  
  class Planet
    abstract
  end
  
  class GazPlanet < Planet
  end
  
  class WaterPlanet < Planet
  end
  
  class Universe
    has_many Planet
  end
  
end

DSLize::Formatter::XSD.new.generate!(ARGV[0])

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dslize-0.0.5 sample.rb
dslize-0.0.4 sample.rb