Sha256: 5306b8aa0b3cc24f403459720ceed79c070b437c3fccc8bc1d11f206217b4129

Contents?: true

Size: 726 Bytes

Versions: 2

Compression:

Stored size: 726 Bytes

Contents

module Rubeus::Extensions::Java::Awt
  module Dimension
    def self.included(base)
      base.extend ClassMethods
    end
    
    module ClassMethods
      def create(*args)
        values = args
        if args.length == 0
          return new
        elsif args.length == 1
          if args.first.is_a?(Array)
            return create(*args.first)
          elsif args.first.is_a?(Rubeus::Awt::Dimension)
            return args.first
          else
            values = args.first.to_s.split("x", 2)
          end
        end
        if values.length == 2
          new(*values.map{|s|s.to_i})
        else
          raise ArgumentError, "Unsupported arguments: #{args.inspect}"
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubeus-0.0.8-java lib/rubeus/extensions/java/awt/dimension.rb
rubeus-0.0.7-java lib/rubeus/extensions/java/awt/dimension.rb