class Animal
has :species
end
class Barn
has :animals, :collect => Animal
end
class Farm
has Barn
end
farm = Farm do
# this is new - will call Barn.new(&block)
barn do
animal 'chicken'
animal 'pig'
end
end
Will not try this for an attribute with :abstract => true
class Name < String
include Doodle::Core
from String do |s|
Name.new(s)
end
end
class Person < Doodle
has Name
end
person = Person 'Arthur'
person.name.class # => Name
has :name, :kind => [String, Symbol]
has Person --> has :person, :kind => Person has AudioClip --> has :audio_clip, :kind => AudioClip
must "size > 0" must "self =~ /[A-Z]"
which will be evaluated as if you had written this:
must "self =~ /[A-Z]" do |v|
v.instance_eval("self =~ /[A-Z]")
end
class Foo < Doodle
instead of
class Foo < Doodle::Base
Generated with the Darkfish Rdoc Generator 1.1.6.