Sha256: a9b79ca6b9a2d25a16210299871a345c000a147880c263aaaee2367840a6148d

Contents?: true

Size: 619 Bytes

Versions: 18

Compression:

Stored size: 619 Bytes

Contents

module WhereTo
  class Location
    include Comparable
    attr_accessor :folder, :filename, :location

    def initialize(from_location)
      @location = from_location
      set_filename_folder_from_location
    end

    def <=>(other)
      location <=> other
    end

    private

    def set_filename_folder_from_location
      split = location.split '/'
      last  = split[-1]
      if File.extname(last) == '' # No extension; is a directory
        @folder   = location + '/'
        @filename = ''
      else
        @filename = split.pop
        @folder   = split.join('/') + '/'
      end
    end 

  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
where_to-1.1.0 lib/where_to/location.rb
where_to-1.0.7 lib/where_to/location.rb
where_to-1.0.6 lib/where_to/location.rb
where_to-1.0.5 lib/where_to/location.rb
where_to-1.0.4 lib/where_to/location.rb
where_to-1.0.3 lib/where_to/location.rb
where_to-1.0.2 lib/where_to/location.rb
where_to-1.0.1 lib/where_to/location.rb
where_to-1.0.0 lib/where_to/location.rb
where_to-0.9.6 lib/where_to/location.rb
where_to-0.9.5 lib/where_to/location.rb
where_to-0.9.4 lib/where_to/location.rb
where_to-0.9.3 lib/where_to/location.rb
where_to-0.9.2 lib/where_to/location.rb
where_to-0.9.1 lib/where_to/location.rb
where_to-0.9.0 lib/where_to/location.rb
where_to-0.8.1 lib/where_to/location.rb
where_to-0.8.0 lib/where_to/location.rb