Class: CmdLine::CacheFile
- Inherits:
-
Object
- Object
- CmdLine::CacheFile
- Defined in:
- lib/cmdline/cachefile.rb
Instance Attribute Summary collapse
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#pathname ⇒ Object
readonly
Returns the value of attribute pathname.
Instance Method Summary collapse
-
#initialize(cache_dir, args) ⇒ CacheFile
constructor
A new instance of CacheFile.
- #readlines ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(cache_dir, args) ⇒ CacheFile
Returns a new instance of CacheFile.
14 15 16 17 18 19 20 |
# File 'lib/cmdline/cachefile.rb', line 14 def initialize cache_dir, args @args = args basename = FileName.new(args).name fullname = Pathname(cache_dir) + basename @pathname = GzipPathname.new fullname @output = nil end |
Instance Attribute Details
#output ⇒ Object (readonly)
Returns the value of attribute output.
11 12 13 |
# File 'lib/cmdline/cachefile.rb', line 11 def output @output end |
#pathname ⇒ Object (readonly)
Returns the value of attribute pathname.
12 13 14 |
# File 'lib/cmdline/cachefile.rb', line 12 def pathname @pathname end |
Instance Method Details
#readlines ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/cmdline/cachefile.rb', line 22 def readlines if @pathname.exist? @output = @pathname.read_file else cl = CommandLine.new @args @output = cl.execute @pathname.save_file @output @output end end |
#to_s ⇒ Object
33 34 35 |
# File 'lib/cmdline/cachefile.rb', line 33 def to_s @pathname.to_s end |