Class: LocalPac::File

Inherits:
Object
  • Object
show all
Defined in:
lib/local_pac/file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, content = '') ⇒ File

Returns a new instance of File.



13
14
15
16
17
18
# File 'lib/local_pac/file.rb', line 13

def initialize(path, content = '')
  @path      = path
  @extension = ::File.extname(path)
  @name      = path.sub(/\.[^.]+$/, '').gsub(%r{/}, '::').downcase.to_sym
  @content   = content
end

Instance Attribute Details

#compressed_contentObject

Returns the value of attribute compressed_content.



10
11
12
# File 'lib/local_pac/file.rb', line 10

def compressed_content
  @compressed_content
end

#contentObject (readonly)

Returns the value of attribute content.



11
12
13
# File 'lib/local_pac/file.rb', line 11

def content
  @content
end

#nameObject (readonly)

Returns the value of attribute name.



11
12
13
# File 'lib/local_pac/file.rb', line 11

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



11
12
13
# File 'lib/local_pac/file.rb', line 11

def path
  @path
end

Instance Method Details

#extension?(ext) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/local_pac/file.rb', line 24

def extension?(ext)
  extension == ext
end

#nil?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/local_pac/file.rb', line 20

def nil?
  false
end

#prepare(handler) ⇒ Object



28
29
30
# File 'lib/local_pac/file.rb', line 28

def prepare(handler)
  handler.prepare(self)
end