Sha256: a527695306fcb8c71903ca3f93177c8829ff934ba1c521d6143adf0fce513da1

Contents?: true

Size: 763 Bytes

Versions: 21

Compression:

Stored size: 763 Bytes

Contents

module ZTK
  module GoogleChart
    class Base

      module Options

        def options=(value)
          set_options(value)
        end

        def options(value=nil)
          set_options(value)
        end

      private

        def default_width
          900
        end

        def set_options(value=nil)
          if @chart_options.nil?
            @chart_options = Hash.new
            @chart_options.merge!(:width => default_width.to_i, :height => default_width.div(2).to_i)
          end

          if !value.nil? && !value.empty?
            @chart_options.merge!(value)
          end

          config.ui.logger.info { "options(#{value.inspect}) -> #{@chart_options.inspect}" }

          @chart_options
        end

      end

    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
ztk-3.3.2 lib/ztk/google_chart/base/options.rb
ztk-3.3.1 lib/ztk/google_chart/base/options.rb
ztk-3.3.0 lib/ztk/google_chart/base/options.rb
ztk-3.2.6 lib/ztk/google_chart/base/options.rb
ztk-3.2.5 lib/ztk/google_chart/base/options.rb
ztk-3.2.4 lib/ztk/google_chart/base/options.rb
ztk-3.2.3 lib/ztk/google_chart/base/options.rb
ztk-3.2.2 lib/ztk/google_chart/base/options.rb
ztk-3.2.1 lib/ztk/google_chart/base/options.rb
ztk-3.2.0 lib/ztk/google_chart/base/options.rb
ztk-3.1.0 lib/ztk/google_chart/base/options.rb
ztk-3.0.4 lib/ztk/google_chart/base/options.rb
ztk-3.0.3 lib/ztk/google_chart/base/options.rb
ztk-3.0.2 lib/ztk/google_chart/base/options.rb
ztk-3.0.1 lib/ztk/google_chart/base/options.rb
ztk-3.0.0 lib/ztk/google_chart/base/options.rb
ztk-2.4.2 lib/ztk/google_chart/base/options.rb
ztk-2.4.1 lib/ztk/google_chart/base/options.rb
ztk-2.4.0 lib/ztk/google_chart/base/options.rb
ztk-2.3.1 lib/ztk/google_chart/base/options.rb