Sha256: 6c4e8c98114dffb7592e35167634a1aef2fbfa7bae237aeef41def0d78de8925

Contents?: true

Size: 983 Bytes

Versions: 2

Compression:

Stored size: 983 Bytes

Contents

# coding: utf-8

module Thinreports
  module Core::Shape

    # @abstract
    class Base::Internal
      include Utils
      extend  Forwardable

      def self.format_delegators(*args)
        def_delegators :format, *args
      end
      private_class_method :format_delegators

      attr_reader :parent
      attr_reader :format
      attr_writer :style
      attr_accessor :states

      def initialize(parent, format)
        @parent = parent
        @format = format
        @states = {}
        @style  = nil

        @finalized_attributes = nil
      end

      def style
        raise NotImplementedError
      end

      def copy(new_parent, &block)
        new_internal = self.class.new(new_parent, format)
        new_internal.style  = style.copy
        new_internal.states = deep_copy(states)

        block.call(new_internal) if block_given?
        new_internal
      end

      def type_of?(type_name)
        raise NotImplementedError
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
thinreports-0.8.1 lib/thinreports/core/shape/base/internal.rb
thinreports-0.8.0 lib/thinreports/core/shape/base/internal.rb