Class: Passifier::StaticFile

Inherits:
Object
  • Object
show all
Defined in:
lib/passifier/static_file.rb

Overview

A single local static file asset

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, path_to_file) ⇒ StaticFile

Returns a new instance of StaticFile.

Parameters:

  • name (String, Symbol)

    The name of the asset

  • path_to_file (String)

    The local path to the asset file



13
14
15
16
17
# File 'lib/passifier/static_file.rb', line 13

def initialize(name, path_to_file)
  @name = name
  @path = path_to_file
  @content = File.open(@path, 'rb') {|file| file.read }
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



8
9
10
# File 'lib/passifier/static_file.rb', line 8

def content
  @content
end

#nameObject (readonly) Also known as: filename

Returns the value of attribute name.



8
9
10
# File 'lib/passifier/static_file.rb', line 8

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



8
9
10
# File 'lib/passifier/static_file.rb', line 8

def path
  @path
end