Sha256: d50869a19297307689c01f084f433f3cf6ec31175db1e2eb0d86984e529abe9f

Contents?: true

Size: 1.24 KB

Versions: 29

Compression:

Stored size: 1.24 KB

Contents

class Card
  class View
    module Options
      module KeyLists
        # all standard option keys
        # @return [Array]
        def all_keys
          @all_keys ||= keymap.each_with_object([]) { |(_k, v), a| a.push(*v) }
        end

        # keys whose values can be set by Sharks in card nests
        # @return [Array]
        def shark_keys
          @shark_keys ||= ::Set.new(keymap[:both]) + keymap[:shark]
        end

        # keys that follow simple standard inheritance pattern from parent views
        # @return [Array]
        def heir_keys
          @heir_keys ||= ::Set.new(keymap[:both]) + keymap[:heir]
        end

        # Keys that can be read or written via accessors
        # @return [Array]
        def accessible_keys
          all_keys - [   # (all but the following)
            :view,       # view is accessed as requested_view or ok_view and cannot be
            # directly manipulated
            :show, :hide # these have a more extensive API (see Card::View::Visibility)
          ]
        end

        def slot_keys
          @slot_keys ||= all_keys - [:skip_perms]
        end

        def reset_key_lists
          @all_keys = nil
          @shark_keys = nil
          @heir_keys = nil
        end
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
card-1.108.1 lib/card/view/options/key_lists.rb
card-1.108.0 lib/card/view/options/key_lists.rb
card-1.107.0 lib/card/view/options/key_lists.rb
card-1.106.0 lib/card/view/options/key_lists.rb
card-1.105.6 lib/card/view/options/key_lists.rb
card-1.105.5 lib/card/view/options/key_lists.rb
card-1.105.4 lib/card/view/options/key_lists.rb
card-1.105.3 lib/card/view/options/key_lists.rb
card-1.105.2.pre1 lib/card/view/options/key_lists.rb
card-1.105.2 lib/card/view/options/key_lists.rb
card-1.105.1 lib/card/view/options/key_lists.rb
card-1.105.0 lib/card/view/options/key_lists.rb
card-1.104.2 lib/card/view/options/key_lists.rb
card-1.104.1 lib/card/view/options/key_lists.rb
card-1.104.0 lib/card/view/options/key_lists.rb
card-1.103.4 lib/card/view/options/key_lists.rb
card-1.103.3 lib/card/view/options/key_lists.rb
card-1.103.2 lib/card/view/options/key_lists.rb
card-1.103.1 lib/card/view/options/key_lists.rb
card-1.103.0 lib/card/view/options/key_lists.rb