class Femto::Model::ModelCreator

Attributes

class_opts[RW]
custom_methods[RW]
defaults[RW]
fields[RW]
storage_name[RW]
types[RW]

Public Class Methods

new() click to toggle source
# File lib/femto/model.rb, line 104
def initialize
  @fields = []
  @defaults = {}
  @types = {}
  @custom_methods = {}
end

Public Instance Methods

class_options(&block) click to toggle source
# File lib/femto/model.rb, line 119
def class_options(&block)
  @class_opts = block
end
field(name, options={}) click to toggle source
# File lib/femto/model.rb, line 111
def field(name, options={})
  return unless name
  fields << name
  if options[:default]
    defaults[name]
  end
end
set_method(name, &block) click to toggle source
# File lib/femto/model.rb, line 123
def set_method(name, &block)
  custom_methods[name] = block
end
storage(name) click to toggle source
# File lib/femto/model.rb, line 127
def storage(name)
  @storage_name = name
end