Sha256: 83ea0664fa66d5c60537084ad7dcacbca62d6c3efcd22837066375014edd418d

Contents?: true

Size: 958 Bytes

Versions: 9

Compression:

Stored size: 958 Bytes

Contents

# -*- encoding : utf-8 -*-
module RademadeAdmin
  module Model
    class Info
      class Field

        UNSAVED_FIELDS = [:id, :_id, :created_at, :deleted_at, :position]

        attr_reader :name, :setter, :getter, :localizable, :relation_name

        def key=(status)
          @is_key = status
        end

        def primary?
          @primary
        end

        def save?
          not UNSAVED_FIELDS.include? name
        end

        def date_time?
          @is_date_time
        end

        def string?
          @is_string
        end

        protected

        def initialize(opts = {})
          @name = opts[:name]
          @primary = opts[:primary]
          @setter = opts[:setter]
          @getter = opts[:getter]
          @is_string = opts[:is_string]
          @is_date_time = opts[:is_date_time]
          @localizable = opts[:localizable]
          @relation_name = opts[:relation_name]
        end

      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rademade_admin-0.2.2 lib/rademade_admin/model/info/field.rb
rademade_admin-0.2.1 lib/rademade_admin/model/info/field.rb
rademade_admin-0.2.0 lib/rademade_admin/model/info/field.rb
rademade_admin-0.1.6 lib/rademade_admin/model/info/field.rb
rademade_admin-0.1.5 lib/rademade_admin/model/info/field.rb
rademade_admin-0.1.4 lib/rademade_admin/model/info/field.rb
rademade_admin-0.1.3 lib/rademade_admin/model/info/field.rb
rademade_admin-0.1.2 lib/rademade_admin/model/info/field.rb
rademade_admin-0.1.1 lib/rademade_admin/model/info/field.rb