Class: ShoppingCart::CreditCardDecorator

Inherits:
Drape::Decorator
  • Object
show all
Defined in:
app/decorators/shopping_cart/credit_card_decorator.rb

Instance Method Summary collapse

Instance Method Details

#expirationObject



9
10
11
# File 'app/decorators/shopping_cart/credit_card_decorator.rb', line 9

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

#full_infoObject



17
18
19
20
21
22
23
24
25
# File 'app/decorators/shopping_cart/credit_card_decorator.rb', line 17

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

#holderObject



5
6
7
# File 'app/decorators/shopping_cart/credit_card_decorator.rb', line 5

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

#protected_numberObject



13
14
15
# File 'app/decorators/shopping_cart/credit_card_decorator.rb', line 13

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