Sha256: 25bd4102a99b65f24146f7b9b868a79558c1063cd5d75d047c654f3aa09bd192

Contents?: true

Size: 631 Bytes

Versions: 24

Compression:

Stored size: 631 Bytes

Contents

class Tramway::Landing::NavbarDecorator < ::Tramway::Core::ApplicationDecoratedCollection
  def initialize(array)
    original = if array.any? { |obj| obj.is_a? Hash }
                 get_original_array array
               else
                 array
               end
    super array, original
  end

  def original_array
    get_original_array @original_array
  end

  def dropdown_title
    object.keys.first
  end

  private

  def get_original_array(arr)
    arr.reduce([]) do |array, obj|
      if obj.is_a? Hash
        array += obj.values.first.original_array
      else
        array << obj
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
tramway-landing-1.8 app/decorators/tramway/landing/navbar_decorator.rb
tramway-landing-1.7.2 app/decorators/tramway/landing/navbar_decorator.rb
tramway-landing-1.7.1.2 app/decorators/tramway/landing/navbar_decorator.rb
tramway-landing-1.7.1.1 app/decorators/tramway/landing/navbar_decorator.rb
tramway-landing-1.7.1 app/decorators/tramway/landing/navbar_decorator.rb
tramway-landing-1.7 app/decorators/tramway/landing/navbar_decorator.rb
tramway-landing-1.6 app/decorators/tramway/landing/navbar_decorator.rb
tramway-landing-1.5.2 app/decorators/tramway/landing/navbar_decorator.rb
tramway-landing-1.5.1.2 app/decorators/tramway/landing/navbar_decorator.rb
tramway-landing-1.5.1.1 app/decorators/tramway/landing/navbar_decorator.rb
tramway-landing-1.5.1 app/decorators/tramway/landing/navbar_decorator.rb
tramway-landing-1.5 app/decorators/tramway/landing/navbar_decorator.rb
tramway-landing-1.4.7.4 app/decorators/tramway/landing/navbar_decorator.rb
tramway-landing-1.4.7.3 app/decorators/tramway/landing/navbar_decorator.rb
tramway-landing-1.4.7.2 app/decorators/tramway/landing/navbar_decorator.rb
tramway-landing-1.4.7.1 app/decorators/tramway/landing/navbar_decorator.rb
tramway-landing-1.4.7 app/decorators/tramway/landing/navbar_decorator.rb
tramway-landing-1.4.6 app/decorators/tramway/landing/navbar_decorator.rb
tramway-landing-1.4.5 app/decorators/tramway/landing/navbar_decorator.rb
tramway-landing-1.4.4 app/decorators/tramway/landing/navbar_decorator.rb