Class: MiscFile
- Inherits:
-
Zarchitect
- Object
- Zarchitect
- MiscFile
- 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
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path) ⇒ MiscFile
constructor
A new instance of MiscFile.
Methods inherited from Zarchitect
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
#size ⇒ Object (readonly)
Returns the value of attribute size.
2 3 4 |
# File 'lib/zarchitect/misc_file.rb', line 2 def size @size end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
2 3 4 |
# File 'lib/zarchitect/misc_file.rb', line 2 def type @type end |
#url ⇒ Object (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 |