Sha256: 395bdda0cdf2ebf7cd32b5984c28fb53728964ab5c28fafca9026878c31d249b

Contents?: true

Size: 1.48 KB

Versions: 22

Compression:

Stored size: 1.48 KB

Contents

class Canvas
  include Mongoid::Document
  field :name
  embeds_many :shapes
  embeds_one :writer
  embeds_one :palette

  def render
    shapes.each { |shape| render }
  end
end

class Browser < Canvas
  field :version, :type => Integer
  def render; end
end

class Firefox < Browser
  field :user_agent
  def render; end
end

class Shape
  include Mongoid::Document
  field :x, :type => Integer, :default => 0
  field :y, :type => Integer, :default => 0

  embedded_in :canvas

  def render; end
end

class Square < Shape
  field :width, :type => Integer, :default => 0
  field :height, :type => Integer, :default => 0
end

class Circle < Shape
  field :radius, :type => Integer, :default => 0
end

class Writer
  include Mongoid::Document
  field :speed, :type => Integer, :default => 0

  embedded_in :canvas

  def write; end
end

class HtmlWriter < Writer
  def write; end
end

class PdfWriter < Writer
  def write; end
end

class Palette
  include Mongoid::Document
  embedded_in :canvas
  embeds_many :tools
end

class Tool
  include Mongoid::Document
  embedded_in :palette
end

class Pencil < Tool; end

class Eraser < Tool; end

########################################
# These are for references relationships
########################################
class ShippingContainer
  include Mongoid::Document
  references_many :vehicles
end
class Vehicle
  include Mongoid::Document
  referenced_in :shipping_container
end
class Bed; end
class Car < Vehicle; end
class Truck < Vehicle
  embeds_one :bed
end

Version data entries

22 entries across 22 versions & 4 rubygems

Version Path
mongoid_spacial-0.2.17 spec/models/inheritance.rb
sig_mongoid_spacial-0.2.17 spec/models/inheritance.rb
cb_mongoid_spacial-0.2.16 spec/models/inheritance.rb
mongoid_geospatial-1.0.0 spec/models/inheritance.rb
mongoid_geospatial-1.0.0rc1 spec/models/inheritance.rb
mongoid_geospatial-1.0.0rc0 spec/models/inheritance.rb
mongoid_spacial-0.2.16 spec/models/inheritance.rb
mongoid_spacial-0.2.13 spec/models/inheritance.rb
mongoid_spacial-0.2.12 spec/models/inheritance.rb
mongoid_spacial-0.2.11 spec/models/inheritance.rb
mongoid_spacial-0.2.10 spec/models/inheritance.rb
mongoid_spacial-0.2.8 spec/models/inheritance.rb
mongoid_spacial-0.2.7 spec/models/inheritance.rb
mongoid_spacial-0.2.6 spec/models/inheritance.rb
mongoid_spacial-0.2.5 spec/models/inheritance.rb
mongoid_spacial-0.2.4 spec/models/inheritance.rb
mongoid_spacial-0.2.3 spec/models/inheritance.rb
mongoid_spacial-0.2.2 spec/models/inheritance.rb
mongoid_spacial-0.2.0 spec/models/inheritance.rb
mongoid_spacial-0.1.1 spec/models/inheritance.rb