Class: RakeVersion::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/rake-version/context.rb

Instance Method Summary collapse

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

#rootObject



10
11
12
# File 'lib/rake-version/context.rb', line 10

def root
  File.expand_path @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