Sha256: c62f52ffa16697543ed4d3fad51cd6240e42c89c94c3348e2b62edd60152a9ea

Contents?: true

Size: 533 Bytes

Versions: 62

Compression:

Stored size: 533 Bytes

Contents

require 'hobo_fields/types/enum_string'

module HoboFields

  class FieldDeclarationDsl < BlankSlate

    include HoboFields::Types::EnumString::DeclarationHelper

    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.first, *args.rest)
    end

  end

end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
hobo_fields-2.2.6 lib/hobo_fields/field_declaration_dsl.rb
hobo_fields-2.2.5 lib/hobo_fields/field_declaration_dsl.rb
hobo_fields-2.2.4 lib/hobo_fields/field_declaration_dsl.rb
hobo_fields-2.2.3 lib/hobo_fields/field_declaration_dsl.rb
hobo_fields-2.2.2 lib/hobo_fields/field_declaration_dsl.rb
hobo_fields-2.2.1 lib/hobo_fields/field_declaration_dsl.rb
hobo_fields-2.2.0 lib/hobo_fields/field_declaration_dsl.rb
hobo_fields-2.1.2 lib/hobo_fields/field_declaration_dsl.rb
hobo_fields-2.1.1 lib/hobo_fields/field_declaration_dsl.rb
hobo_fields-2.1.0 lib/hobo_fields/field_declaration_dsl.rb
hobo_fields-2.1.0.pre4 lib/hobo_fields/field_declaration_dsl.rb
hobo_fields-2.1.0.pre3 lib/hobo_fields/field_declaration_dsl.rb
hobo_fields-2.1.0.pre2 lib/hobo_fields/field_declaration_dsl.rb
hobo_fields-2.1.0.pre1 lib/hobo_fields/field_declaration_dsl.rb
hobo_fields-2.0.1 lib/hobo_fields/field_declaration_dsl.rb
hobo_fields-2.0.0 lib/hobo_fields/field_declaration_dsl.rb
hobo_fields-2.0.0.pre10 lib/hobo_fields/field_declaration_dsl.rb
hobo_fields-2.0.0.pre9 lib/hobo_fields/field_declaration_dsl.rb
hobo_fields-2.0.0.pre8 lib/hobo_fields/field_declaration_dsl.rb
hobo_fields-1.3.3 lib/hobo_fields/field_declaration_dsl.rb