Sha256: 6bfa156936deeb6750000dd0f64bd60c1989ade403616caf1086cf20ac487a7c

Contents?: true

Size: 546 Bytes

Versions: 3

Compression:

Stored size: 546 Bytes

Contents

# frozen_string_literal: true

require 'active_support/concern'
require 'active_model'

module PlainModel
  module Modeling
    module Base
      Column = Struct.new(:name)

      extend ActiveSupport::Concern
      include ActiveModel::Model
      include ActiveModel::Attributes

      class_methods do
        def column_names
          return @column_names if defined?(@column_names)

          @column_names = attribute_types.keys.map do |name|
            Column.new(name: name.to_sym)
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
plain_model-0.2.1 lib/plain_model/modeling/base.rb
plain_model-0.2.0 lib/plain_model/modeling/base.rb
plain_model-0.1.0 lib/plain_model/modeling/base.rb