class Property::Role

The Role holds information on a group of property columns. The “Role” is used in the same way as the ruby Module: as a mixin. The Schema class “includes” roles.

Public Class Methods

new(name, opts = nil, &block) click to toggle source

Create a new role. If a block is provided, this block can be used to define properties:

Example:

@role = Role.new('Poet') do |p|
  p.string :muse
end
Calls superclass method
# File lib/property/role.rb, line 17
def self.new(name, opts = nil, &block)
  if name.kind_of?(Hash)
    obj = super(name[:name] || name['name'], opts)
  else
    obj = super(name, opts)
  end

  if block_given?
    obj.property(&block)
  end
  obj
end
new(name, opts = nil) click to toggle source

Initialize a new role with the given name

# File lib/property/role.rb, line 31
def initialize(name, opts = nil)
  @name = name
end