Class: SiteMaps::Adapters::FileSystem::Location

Inherits:
Struct
  • Object
show all
Defined in:
lib/site_maps/adapters/file_system/location.rb

Direct Known Subclasses

AwsSdk::Location

Constant Summary collapse

ROOT_RE =
%r{^/}
GZIP_RE =
%r{\.gz$}

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#rootObject

Returns the value of attribute root

Returns:

  • (Object)

    the current value of root



3
4
5
# File 'lib/site_maps/adapters/file_system/location.rb', line 3

def root
  @root
end

#urlObject

Returns the value of attribute url

Returns:

  • (Object)

    the current value of url



3
4
5
# File 'lib/site_maps/adapters/file_system/location.rb', line 3

def url
  @url
end

Instance Method Details

#directoryObject



14
15
16
# File 'lib/site_maps/adapters/file_system/location.rb', line 14

def directory
  Pathname.new(root).join(remote_relative_dir).to_s
end

#gzip?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/site_maps/adapters/file_system/location.rb', line 18

def gzip?
  GZIP_RE.match?(uri.path)
end

#pathObject



7
8
9
10
11
12
# File 'lib/site_maps/adapters/file_system/location.rb', line 7

def path
  File.join(
    root,
    make_relative(uri.path)
  )
end