Sha256: af24c5374cb843ca9d01e38df90995afa891c50de0fcb1fb917479157df6a118

Contents?: true

Size: 411 Bytes

Versions: 1

Compression:

Stored size: 411 Bytes

Contents

# frozen_string_literal: true

class CouponType
  include EnumField::DefineEnum

  attr_reader :code, :symbol

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

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

  define_enum do |builder|
    builder.member :money,      object: new('money', '$')
    builder.member :percentage, object: new('percentage', '%')
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
translation_cms-0.1.5 app/models/enums/coupon_type.rb