Sha256: 9ae30788899539be495b70472fbf216e3cb6dd2aa3212d9af2c2ae56551638ee

Contents?: true

Size: 393 Bytes

Versions: 1

Compression:

Stored size: 393 Bytes

Contents

module Shopper
  module CartPage
    class CouponDecorator < SimpleDelegator
      def error_class
        'has-error' if error_message
      end

      def helper?
        error_message
      end

      def helper
        error_message
      end

      private

      def error_message
        @error_message ||= __getobj__.errors&.full_messages_for(:code)&.first
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shoppper-0.1.0 app/decorators/shopper/cart_page/coupon_decorator.rb