Sha256: e743dacce9aab8f81f2b9f9104d877e619787e4d5e9fdc7de4870038f8b2baca

Contents?: true

Size: 653 Bytes

Versions: 21

Compression:

Stored size: 653 Bytes

Contents

module Paperclip
  class GeometryParser
    FORMAT = /\b(\d*)x?(\d*)\b(?:,(\d?))?(\@\>|\>\@|[\>\<\#\@\%^!])?/i
    def initialize(string)
      @string = string
    end

    def make
      if match
        Geometry.new(
          :height => @height,
          :width => @width,
          :modifier => @modifier,
          :orientation => @orientation
        )
      end
    end

    private

    def match
      if actual_match = @string && @string.match(FORMAT)
        @width = actual_match[1]
        @height = actual_match[2]
        @orientation = actual_match[3]
        @modifier = actual_match[4]
      end
      actual_match
    end
  end
end

Version data entries

21 entries across 21 versions & 5 rubygems

Version Path
kt-paperclip-5.4.0 lib/paperclip/geometry_parser_factory.rb
kt-paperclip-4.4.0 lib/paperclip/geometry_parser_factory.rb
paperclip-6.1.0 lib/paperclip/geometry_parser_factory.rb
paperclip-6.0.0 lib/paperclip/geometry_parser_factory.rb
paperclip-5.3.0 lib/paperclip/geometry_parser_factory.rb
paperclip-5.2.1 lib/paperclip/geometry_parser_factory.rb
paperclip-5.2.0 lib/paperclip/geometry_parser_factory.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/paperclip-5.1.0/lib/paperclip/geometry_parser_factory.rb
paperclip-5.1.0 lib/paperclip/geometry_parser_factory.rb
paperclip-5.0.0 lib/paperclip/geometry_parser_factory.rb
paperclip-4.3.7 lib/paperclip/geometry_parser_factory.rb
paperclip_jk-5.0.0.beta2 lib/paperclip/geometry_parser_factory.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/paperclip-4.3.6/lib/paperclip/geometry_parser_factory.rb
paperclip-5.0.0.beta2 lib/paperclip/geometry_parser_factory.rb
paperclip-5.0.0.beta1 lib/paperclip/geometry_parser_factory.rb
paperclip-4.3.6 lib/paperclip/geometry_parser_factory.rb
paperclip-4.3.5 lib/paperclip/geometry_parser_factory.rb
paperclip-4.3.4 lib/paperclip/geometry_parser_factory.rb
paperclip-4.3.3 lib/paperclip/geometry_parser_factory.rb
paperclip-4.3.2 lib/paperclip/geometry_parser_factory.rb