Sha256: 1f3d9c94cd487c4ae917064c64571ee701205a6a5dd6ef3900fe6610fa6d7f3f

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

# coding: utf-8

module ThinReports
  module Core::Shape
    
    # @private
    # @abstract
    class Base::Internal
      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 = states.simple_deep_copy
        
        block.call(new_internal) if block_given?
        new_internal
      end
      
      def switch_parent!(new_parent)
        @parent = new_parent
        self
      end
      
      def type_of?(type_name)
        raise NotImplementedError
      end
    end
    
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
thinreports-0.7.7 lib/thinreports/core/shape/base/internal.rb
thinreports-0.7.6 lib/thinreports/core/shape/base/internal.rb
thinreports-0.7.5 lib/thinreports/core/shape/base/internal.rb
thinreports-0.7.0 lib/thinreports/core/shape/base/internal.rb