Class: RakeVersion::Context
- Inherits:
-
Object
- Object
- RakeVersion::Context
- Defined in:
- lib/rake-version/context.rb
Instance Method Summary collapse
-
#initialize(task) ⇒ Context
constructor
A new instance of Context.
- #read(file) ⇒ Object
- #root ⇒ Object
- #write(file, contents) ⇒ Object
Constructor Details
#initialize(task) ⇒ Context
Returns a new instance of Context.
6 7 8 |
# File 'lib/rake-version/context.rb', line 6 def initialize task @task = task end |
Instance Method Details
#read(file) ⇒ Object
14 15 16 |
# File 'lib/rake-version/context.rb', line 14 def read file File.open(file, 'r').read end |
#root ⇒ Object
10 11 12 |
# File 'lib/rake-version/context.rb', line 10 def root File. @task.application.original_dir end |
#write(file, contents) ⇒ Object
18 19 20 |
# File 'lib/rake-version/context.rb', line 18 def write file, contents File.open(file, 'w'){ |f| f.write contents } end |