Sha256: 264f7b9c493a2236af2af77e7eded86dbfa0d7398f7af966dce90d4838947c2e

Contents?: true

Size: 608 Bytes

Versions: 3

Compression:

Stored size: 608 Bytes

Contents

module ShoppingCart
  class CreditCardDecorator < Drape::Decorator
    delegate_all

    def holder
      "#{object.first_name} #{object.last_name}"
    end

    def expiration
      "#{object.month} / #{object.year}"
    end

    def protected_number
      "xxxx-xxxx-xxxx-#{object.number[-4..-1]}"
    end

    def full_info
      h.capture_haml do
        h.haml_tag :ul, class: 'list-unstyled' do
          h.haml_tag(:li) { h.haml_concat holder }
          h.haml_tag(:li) { h.haml_concat protected_number }
          h.haml_tag(:li) { h.haml_concat expiration }
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shopping-cart-0.1.2 app/decorators/shopping_cart/credit_card_decorator.rb
shopping-cart-0.1.1 app/decorators/shopping_cart/credit_card_decorator.rb
shopping-cart-0.1.0 app/decorators/shopping_cart/credit_card_decorator.rb