Sha256: 90aa30f934c9467edca31c339d45dbcf46681d54e9ab4463aa0f9eed55fd82f1

Contents?: true

Size: 643 Bytes

Versions: 22

Compression:

Stored size: 643 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

22 entries across 20 versions & 2 rubygems

Version Path
solidus_backend-1.0.0.pre3 vendor/bundle/gems/paperclip-4.2.4/lib/paperclip/geometry_parser_factory.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/paperclip-4.2.4/lib/paperclip/geometry_parser_factory.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/paperclip-4.2.3/lib/paperclip/geometry_parser_factory.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/paperclip-4.2.4/lib/paperclip/geometry_parser_factory.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/paperclip-4.2.2/lib/paperclip/geometry_parser_factory.rb
paperclip-4.3.0 lib/paperclip/geometry_parser_factory.rb
paperclip-4.2.4 lib/paperclip/geometry_parser_factory.rb
paperclip-4.2.3 lib/paperclip/geometry_parser_factory.rb
paperclip-4.2.2 lib/paperclip/geometry_parser_factory.rb
paperclip-4.2.1 lib/paperclip/geometry_parser_factory.rb
paperclip-4.2.0 lib/paperclip/geometry_parser_factory.rb
paperclip-4.1.1 lib/paperclip/geometry_parser_factory.rb
paperclip-4.1.0 lib/paperclip/geometry_parser_factory.rb
paperclip-3.5.4 lib/paperclip/geometry_parser_factory.rb
paperclip-4.0.0 lib/paperclip/geometry_parser_factory.rb
paperclip-3.5.3 lib/paperclip/geometry_parser_factory.rb
paperclip-3.5.2 lib/paperclip/geometry_parser_factory.rb
paperclip-3.5.1 lib/paperclip/geometry_parser_factory.rb
paperclip-3.5.0 lib/paperclip/geometry_parser_factory.rb
paperclip-3.4.2 lib/paperclip/geometry_parser_factory.rb