class Spectifly::Sequel::Builder

Attributes

entities[RW]
model[RW]

Public Class Methods

new(entity, options = {}) click to toggle source
Calls superclass method
# File lib/spectifly/sequel/builder.rb, line 6
def initialize(entity, options = {})
  super(entity, options)
  @entities = Spectifly::Entity.from_directory(File.dirname(entity.path))
  @model = Spectifly::Sequel::Model.new(entity, fields)
end

Public Instance Methods

build() click to toggle source
# File lib/spectifly/sequel/builder.rb, line 16
def build
  template_path = File.join(*File.dirname(__FILE__), 'erb', 'new_migration.erb')
  render template_path
end
field_class() click to toggle source
# File lib/spectifly/sequel/builder.rb, line 12
def field_class
  Spectifly::Sequel::Field
end

Private Instance Methods

render(path) click to toggle source
# File lib/spectifly/sequel/builder.rb, line 22
def render path
  content = File.read(File.expand_path(path))
  t = ERB.new(content, nil, '-') # third param lets us use trim
  t.filename = File.expand_path(path)
  t.result(binding)
end