Sha256: ff7725047992b61443f71e7a5d4c9b5836bf13004502e8a82a3b563a13c2409a

Contents?: true

Size: 720 Bytes

Versions: 17

Compression:

Stored size: 720 Bytes

Contents

module BrDanfe
  module DanfeLib
    class LogoOptions
      def initialize(bounding_box_size, logo_dimensions)
        @bounding_box_size = bounding_box_size
        @logo_width = logo_dimensions[:width]
        @logo_height = logo_dimensions[:height]
      end

      def options
        logo_options = dimensions
        logo_options[:position] = :center
        logo_options[:vposition] = :center
        logo_options
      end

      private

      def dimensions
        @logo_width > @logo_height ? { width: calculate_size(@logo_width) } : { height: calculate_size(@logo_height) }
      end

      def calculate_size(size)
        size < @bounding_box_size ? size : @bounding_box_size
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
br_danfe-0.11.2 lib/br_danfe/danfe_lib/logo_options.rb
br_danfe-0.11.1 lib/br_danfe/danfe_lib/logo_options.rb
br_danfe-0.11.0 lib/br_danfe/danfe_lib/logo_options.rb
br_danfe-0.10.1 lib/br_danfe/danfe_lib/logo_options.rb
br_danfe-0.10.0 lib/br_danfe/danfe_lib/logo_options.rb
br_danfe-0.8.0 lib/br_danfe/danfe_lib/logo_options.rb
br_danfe-0.7.7 lib/br_danfe/danfe_lib/logo_options.rb
br_danfe-0.7.6 lib/br_danfe/danfe_lib/logo_options.rb
br_danfe-0.7.5 lib/br_danfe/danfe_lib/logo_options.rb
br_danfe-0.7.4 lib/br_danfe/danfe_lib/logo_options.rb
br_danfe-0.7.3 lib/br_danfe/danfe_lib/logo_options.rb
br_danfe-0.7.2 lib/br_danfe/danfe_lib/logo_options.rb
br_danfe-0.7.1 lib/br_danfe/danfe_lib/logo_options.rb
br_danfe-0.7.0 lib/br_danfe/danfe_lib/logo_options.rb
br_danfe-0.6.1 lib/br_danfe/danfe_lib/logo_options.rb
br_danfe-0.6.0 lib/br_danfe/danfe_lib/logo_options.rb
br_danfe-0.5.2 lib/br_danfe/danfe_lib/logo_options.rb