Class: Quick::FS::CodeFile
Constant Summary collapse
- Parser =
RubyParser.new
Instance Attribute Summary collapse
-
#in_use ⇒ Object
readonly
Returns the value of attribute in_use.
Instance Method Summary collapse
-
#initialize(mod, name) ⇒ CodeFile
constructor
A new instance of CodeFile.
- #read_file(path) ⇒ Object
- #size(path) ⇒ Object
- #times(path) ⇒ Object
- #touch(path) ⇒ Object
- #write_to(path, source) ⇒ Object
Constructor Details
#initialize(mod, name) ⇒ CodeFile
Returns a new instance of CodeFile.
78 79 80 81 82 |
# File 'lib/quick/fs.rb', line 78 def initialize(mod, name) @mod, @name = mod, name @source = '' @in_use = ROCodeFile.new @source end |
Instance Attribute Details
#in_use ⇒ Object (readonly)
Returns the value of attribute in_use.
76 77 78 |
# File 'lib/quick/fs.rb', line 76 def in_use @in_use end |
Instance Method Details
#read_file(path) ⇒ Object
84 85 86 87 |
# File 'lib/quick/fs.rb', line 84 def read_file(path) @atime = Time.now @source end |
#size(path) ⇒ Object
89 90 91 |
# File 'lib/quick/fs.rb', line 89 def size(path) @source.bytesize end |
#times(path) ⇒ Object
104 105 106 107 |
# File 'lib/quick/fs.rb', line 104 def times(path) now = Time.now [@atime ||= now, @mtime ||= now, @ctime ||= now] end |
#touch(path) ⇒ Object
100 101 102 |
# File 'lib/quick/fs.rb', line 100 def touch(path) @mtime = Time.now end |
#write_to(path, source) ⇒ Object
93 94 95 96 97 98 |
# File 'lib/quick/fs.rb', line 93 def write_to(path, source) @source = source @mtime = @ctime = Time.now eval! rescue ArgumentError end |