Sha256: f828d2e17b96daaa76eea6a081772031b92e6ae7091371a4d2ac0a25795f463d

Contents?: true

Size: 507 Bytes

Versions: 10

Compression:

Stored size: 507 Bytes

Contents

module Adva
  module View
    class Tabs < Array
      class Tab
        attr_reader :tabs, :name

        def initialize(tabs, name)
          @tabs = tabs
          @name = name
        end

        def active?
          self == tabs.first
        end

        def blocks
          @blocks ||= []
        end
      end

      def tab(name, &block)
        tab = detect { |tab| tab.name == name }
        self << tab = Tab.new(self, name) unless tab
        tab.blocks << block
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
adva-core-0.0.14 lib/adva/view/tabs.rb
adva-core-0.0.13 lib/adva/view/tabs.rb
adva-core-0.0.9 lib/adva/view/tabs.rb
adva-core-0.0.8 lib/adva/view/tabs.rb
adva-core-0.0.7 lib/adva/view/tabs.rb
adva-core-0.0.6 lib/adva/view/tabs.rb
adva-core-0.0.5 lib/adva/view/tabs.rb
adva-core-0.0.4 lib/adva/view/tabs.rb
adva-core-0.0.2 lib/adva/view/tabs.rb
adva-core-0.0.1 lib/adva/view/tabs.rb