Class: FileAttributes
- Inherits:
-
Object
- Object
- FileAttributes
- Defined in:
- lib/dirk.rb
Instance Method Summary collapse
-
#initialize(file) ⇒ FileAttributes
constructor
A new instance of FileAttributes.
- #keys(filename) ⇒ Object
- #read(filename) ⇒ Object
Constructor Details
#initialize(file) ⇒ FileAttributes
Returns a new instance of FileAttributes.
122 123 124 125 126 |
# File 'lib/dirk.rb', line 122 def initialize(file) return false unless file && !File.exists?(file) contents = File.read(file) @attribs = YAML::load(contents) if contents end |
Instance Method Details
#keys(filename) ⇒ Object
132 133 134 |
# File 'lib/dirk.rb', line 132 def keys(filename) @attribs[filename].keys end |
#read(filename) ⇒ Object
128 129 130 |
# File 'lib/dirk.rb', line 128 def read(filename) @attribs[filename]["title"] end |