Sha256: c7a0b08c2ab0560c8da368cae08771124af0ff232ec2be075f219898af007b3c

Contents?: true

Size: 520 Bytes

Versions: 24

Compression:

Stored size: 520 Bytes

Contents

require 'active_support/core_ext/module/delegation'
require 'active_support/core_ext/object/blank'

module Brightcontent
  Resources = Struct.new(:resources) do
    include Enumerable
    delegate :each, :==, to: :resources

    def main_menu
      take main_menu_count
    end

    def extra_menu
      drop main_menu_count
    end

    def extra_menu?
      resources.length > Brightcontent.main_menu_count
    end

    def main_menu_count
      Brightcontent.main_menu_count - (extra_menu? ? 1 : 0)
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
brightcontent-core-2.1.3 lib/brightcontent/resources.rb
brightcontent-core-2.1.2 lib/brightcontent/resources.rb
brightcontent-core-2.1.1 lib/brightcontent/resources.rb
brightcontent-core-2.1.0 lib/brightcontent/resources.rb