Class: AngularConfig::File

Inherits:
Object
  • Object
show all
Defined in:
lib/angular_config/file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source_path) ⇒ File

Returns a new instance of File.



5
6
7
# File 'lib/angular_config/file.rb', line 5

def initialize(source_path)
  @path = ::File.expand_path(source_path)
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/angular_config/file.rb', line 3

def path
  @path
end

Instance Method Details

#contentObject



9
10
11
# File 'lib/angular_config/file.rb', line 9

def content
  ::File.read(path).chomp
end

#content=(data) ⇒ Object



13
14
15
16
17
# File 'lib/angular_config/file.rb', line 13

def content=(data)
  ::File.open(path, "w") do |file|
    file.write(data)
  end
end