Sha256: 2af2dcae9a21f7f07156446c979018c2bef2a91f3bc0ae4b65e9804c9264d29b

Contents?: true

Size: 503 Bytes

Versions: 1

Compression:

Stored size: 503 Bytes

Contents

# frozen_string_literal: true

module AffiliateProgram
  class GenderType
    include EnumField::DefineEnum

    attr_reader :code

    def initialize(code)
      @code = code.to_sym
    end

    def title
      I18n.t(code, scope: [:affiliate_program, :gender_type])
    end

    def self.to_json
      all.map { |s| { id: s.id, title: s.title } }
    end

    define_enum do |builder|
      builder.member :male, object: new(:male)
      builder.member :female, object: new(:female)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
translation_cms-0.1.5 app/models/affiliate_program/gender_type.rb