Sha256: 30e8bd4714c446aee0663f522fec6ec280ad239b74e9d16e0c7b5028dca3f5f4

Contents?: true

Size: 350 Bytes

Versions: 9

Compression:

Stored size: 350 Bytes

Contents

module ActiveRecord
  module Enumerations
    class EnumField
      attr_reader :name
  
      def initialize name
        @name = name.to_s
      end
  
      def enums_getter
        name.pluralize
      end
  
      def enums_setter
        "#{enums_getter}="
      end
  
      def foreign_key
        "#{name}_id"
      end    
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ar-enums-1.0.0 lib/ar_enums/enum_field.rb
ar-enums-0.3.9 lib/ar_enums/enum_field.rb
ar-enums-0.3.8 lib/ar_enums/enum_field.rb
ar-enums-0.3.7 lib/ar_enums/enum_field.rb
ar-enums-0.3.6 lib/ar_enums/enum_field.rb
ar-enums-0.3.5 lib/ar_enums/enum_field.rb
ar-enums-0.3.4 lib/enum_field.rb
ar-enums-0.3.3 lib/enum_field.rb
ar-enums-0.3.2 lib/enum_field.rb