Sha256: 0738a7960f299a358acc2dd84aad823d4d351d7a1caa60ba64950600e6eceb45

Contents?: true

Size: 1.13 KB

Versions: 7

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

module Thinreports
  module Core
    module Shape
      module Base
        # @abstract
        class 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?
            raise NotImplementedError
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
thinreports-0.12.1 lib/thinreports/core/shape/base/internal.rb
thinreports-0.12.0 lib/thinreports/core/shape/base/internal.rb
thinreports-0.11.0 lib/thinreports/core/shape/base/internal.rb
thinreports-0.10.3 lib/thinreports/core/shape/base/internal.rb
thinreports-0.10.2 lib/thinreports/core/shape/base/internal.rb
thinreports-0.10.1 lib/thinreports/core/shape/base/internal.rb
thinreports-0.10.0 lib/thinreports/core/shape/base/internal.rb