Sha256: 3534c5d91e34c0c153550db272f8a4774a2443d4bd939535bc17e5345d8cd883

Contents?: true

Size: 648 Bytes

Versions: 14

Compression:

Stored size: 648 Bytes

Contents

module Paperclip
  class GeometryParser
    FORMAT = /\b(\d*)x?(\d*)\b(?:,(\d?))?(\@\>|\>\@|[\>\<\#\@\%^!])?/i.freeze
    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

14 entries across 14 versions & 1 rubygems

Version Path
kt-paperclip-7.2.2 lib/paperclip/geometry_parser_factory.rb
kt-paperclip-7.2.1 lib/paperclip/geometry_parser_factory.rb
kt-paperclip-7.2.0 lib/paperclip/geometry_parser_factory.rb
kt-paperclip-6.4.2 lib/paperclip/geometry_parser_factory.rb
kt-paperclip-7.1.1 lib/paperclip/geometry_parser_factory.rb
kt-paperclip-7.1.0 lib/paperclip/geometry_parser_factory.rb
kt-paperclip-7.0.1 lib/paperclip/geometry_parser_factory.rb
kt-paperclip-7.0.0 lib/paperclip/geometry_parser_factory.rb
kt-paperclip-6.4.1 lib/paperclip/geometry_parser_factory.rb
kt-paperclip-6.4.0 lib/paperclip/geometry_parser_factory.rb
kt-paperclip-6.3.0 lib/paperclip/geometry_parser_factory.rb
kt-paperclip-6.2.2 lib/paperclip/geometry_parser_factory.rb
kt-paperclip-6.2.1 lib/paperclip/geometry_parser_factory.rb
kt-paperclip-6.2.0 lib/paperclip/geometry_parser_factory.rb