class ModelMaker::EntityBuilder
Attributes
entity[R]
Public Class Methods
new(entity_name, &configuration)
click to toggle source
# File src/lib/modelmaker.rb, line 45 def initialize(entity_name, &configuration) @entity = Entity.new(entity_name) instance_eval(&configuration) end
Public Instance Methods
add_property(property)
click to toggle source
# File src/lib/modelmaker.rb, line 83 def add_property(property) @entity.add_property(property) end
array(propname)
click to toggle source
# File src/lib/modelmaker.rb, line 75 def array(propname) add_property(ArrayProperty.new(propname)) end
conforms_to(protocol)
click to toggle source
# File src/lib/modelmaker.rb, line 54 def conforms_to(protocol) @entity.protocols << protocol end
date(propname)
click to toggle source
# File src/lib/modelmaker.rb, line 79 def date(propname) add_property(DateProperty.new(propname)) end
inherits(superclass)
click to toggle source
# File src/lib/modelmaker.rb, line 50 def inherits(superclass) @entity.superclass = superclass end
int(propname)
click to toggle source
# File src/lib/modelmaker.rb, line 63 def int(propname) add_property(IntegerProperty.new(propname)) end
set(propname)
click to toggle source
# File src/lib/modelmaker.rb, line 67 def set(propname) add_property(SetProperty.new(propname)) end
string(propname)
click to toggle source
There was a way to do that better… “define_all” or something
# File src/lib/modelmaker.rb, line 59 def string(propname) add_property(StringProperty.new(propname)) end
url(propname)
click to toggle source
# File src/lib/modelmaker.rb, line 71 def url(propname) add_property(UrlProperty.new(propname)) end