Class: Redirect::App::StaticFile

Inherits:
Object
  • Object
show all
Defined in:
lib/redirect/app.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ StaticFile

Returns a new instance of StaticFile.



6
7
8
9
# File 'lib/redirect/app.rb', line 6

def initialize(path)
  @path = path
  @path = File.join(path, 'index.html') unless available?
end

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/redirect/app.rb', line 11

def available?
  expanded_path && expanded_path == path && File.file?(expanded_path)
end

#expanded_pathObject



19
20
21
# File 'lib/redirect/app.rb', line 19

def expanded_path
  File.expand_path(path)
end

#pathObject



15
16
17
# File 'lib/redirect/app.rb', line 15

def path
  @path
end