Class: MiscFile

Inherits:
Zarchitect show all
Defined in:
lib/zarchitect/misc_file.rb

Constant Summary

Constants inherited from Zarchitect

Zarchitect::ASSETDIR, Zarchitect::ASSETSDIR, Zarchitect::BUILDIR, Zarchitect::CONFIGDIR, Zarchitect::DEBUGSDIR, Zarchitect::DRAFTDIR, Zarchitect::FILEDIR, Zarchitect::FILESDIR, Zarchitect::HTMLDIR, Zarchitect::LAYOUTDIR, Zarchitect::NODEDIR, Zarchitect::SHARESDIR, Zarchitect::VERSION

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Zarchitect

#main, #rss

Constructor Details

#initialize(path) ⇒ MiscFile

Returns a new instance of MiscFile.



4
5
6
7
8
9
10
# File 'lib/zarchitect/misc_file.rb', line 4

def initialize(path)
  @path = path
  @url = path.clone
  @url[0] = "/"
  @size = File.size(path)
  @type = File.extname(path)[1..-1]
end

Instance Attribute Details

#sizeObject (readonly)

Returns the value of attribute size.



2
3
4
# File 'lib/zarchitect/misc_file.rb', line 2

def size
  @size
end

#typeObject (readonly)

Returns the value of attribute type.



2
3
4
# File 'lib/zarchitect/misc_file.rb', line 2

def type
  @type
end

#urlObject (readonly)

Returns the value of attribute url.



2
3
4
# File 'lib/zarchitect/misc_file.rb', line 2

def url
  @url
end

Class Method Details

.find(k, v) ⇒ Object



12
13
14
15
16
17
# File 'lib/zarchitect/misc_file.rb', line 12

def self.find(k, v)
  ObjectSpace.each_object(MiscFile) do |a|
    str = a.send(k)
    return a if str == v
  end
end