Sha256: ad1f928e2276f848e48a1e249dc89c821ce4cf84356617712b7669b5746aa6b7

Contents?: true

Size: 506 Bytes

Versions: 3

Compression:

Stored size: 506 Bytes

Contents

module ShoppingCart
  class AddressDecorator < Drape::Decorator
    delegate_all

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

    def full_info
      h.capture_haml do
        h.haml_tag :ul, class: 'list-unstyled' do
          h.haml_tag(:li) { h.haml_concat full_name }
          [:street, :city, :country_code, :zipcode, :phone].each do |field|
            h.haml_tag(:li) { h.haml_concat object.public_send(field) }
          end
        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/address_decorator.rb
shopping-cart-0.1.1 app/decorators/shopping_cart/address_decorator.rb
shopping-cart-0.1.0 app/decorators/shopping_cart/address_decorator.rb