Sha256: 5b655e8945e43e5aea904cdec675d8b637fab8d4c373c1ad7fb2192f4ebc7e1e

Contents?: true

Size: 1.42 KB

Versions: 15

Compression:

Stored size: 1.42 KB

Contents

# Author::    Eric Crane  (mailto:eric.crane@mac.com)
# Copyright:: Copyright (c) 2019 Eric Crane.  All rights reserved.
#
# An object that contains a collection of other objects.
#

module Gloo
  module Objs
    class Container < Gloo::Core::Obj

      KEYWORD = 'container'.freeze
      KEYWORD_SHORT = 'can'.freeze

      #
      # The name of the object type.
      #
      def self.typename
        return KEYWORD
      end

      #
      # The short name of the object type.
      #
      def self.short_typename
        return KEYWORD_SHORT
      end

      # ---------------------------------------------------------------------
      #    Messages
      # ---------------------------------------------------------------------

      #
      # Get a list of message names that this object receives.
      #
      def self.messages
        return super + %w[count delete_children show_key_value_table]
      end

      #
      # Count the number of children in the container.
      #
      def msg_count
        i = child_count
        @engine.heap.it.set_to i
        return i
      end

      #
      # Delete all children in the container.
      #
      def msg_delete_children
        self.delete_children
      end

      #
      # Show the given table data.
      #
      def msg_show_key_value_table
        data = self.children.map { |o| [ o.name, o.value ] }
        @engine.platform.show_table nil, data, title
      end

    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
gloo-3.1.1 lib/gloo/objs/basic/container.rb
gloo-3.1.0 lib/gloo/objs/basic/container.rb
gloo-3.0.1 lib/gloo/objs/basic/container.rb
gloo-3.0.0 lib/gloo/objs/basic/container.rb
gloo-2.5.0 lib/gloo/objs/basic/container.rb
gloo-2.4.3 lib/gloo/objs/basic/container.rb
gloo-2.4.2 lib/gloo/objs/basic/container.rb
gloo-2.4.1 lib/gloo/objs/basic/container.rb
gloo-2.4.0 lib/gloo/objs/basic/container.rb
gloo-2.3.1 lib/gloo/objs/basic/container.rb
gloo-2.2.0 lib/gloo/objs/basic/container.rb
gloo-2.1.0 lib/gloo/objs/basic/container.rb
gloo-2.0.2 lib/gloo/objs/basic/container.rb
gloo-2.0.1 lib/gloo/objs/basic/container.rb
gloo-2.0.0 lib/gloo/objs/basic/container.rb