Sha256: e72e7129ed6c14c19b3f8fcaa5b793a7ea5cb1a95d4977ac5febcccbbcedba0c

Contents?: true

Size: 453 Bytes

Versions: 1

Compression:

Stored size: 453 Bytes

Contents

module HoboFields
  
  class FieldDeclarationDsl < BlankSlate
    
    def initialize(model)
      @model = model
    end
    
    attr_reader :model
    
    
    def timestamps
      field(:created_at, :datetime)
      field(:updated_at, :datetime)
    end
    
    
    def field(name, type, *args)
      @model.declare_field(name, type, *args)
    end
    
    
    def method_missing(name, *args)
      field(name, *args)
    end
    
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hobofields-0.7.5 lib/hobo_fields/field_declaration_dsl.rb