Sha256: a452f0b16e0e11de584b503ebd171c0d8b781de7cda53c33581d7950f9477873

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

# coding: utf-8

module ThinReports
  module Core::Shape
    
    class Basic::Interface < Base::Interface
      internal_delegators :visible?, :id, :type
      
      # @param [Boolean] visibility
      # @return [self]
      def visible(visibility)
        internal.visible(visibility)
        self
      end
      
      # @param [Symbol] style_name
      # @param [String] value
      # @return [self]
      def style(style_name, value)
        unless internal.available_style?(style_name)
          raise ThinReports::Errors::UnknownShapeStyleName
        end
        internal.svg_attr(style_name, value)
        self
      end
      
      # @param [Hash] settings
      # @return [self]
      def styles(settings)
        settings.each{ |args| style(*args) }
        self
      end
      
      # @see #visible
      # @return [self]
      def hide
        visible(false)
        self
      end
      
      # @see #visible
      # @return [self]
      def show
        visible(true)
        self
      end
    
    private
      
      # @see ThinReports::Core::Shape::Base::Interface#init_internal
      def init_internal(parent, format)
        Basic::Internal.new(parent, format)
      end
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
thinreports-0.6.0.pre3 lib/thinreports/core/shape/basic/interface.rb