Module: PathMapper::Node::File::Representation

Included in:
PathMapper::Node::File
Defined in:
lib/path_mapper/node/file/representation.rb

Instance Method Summary collapse

Instance Method Details

#boolObject



23
24
25
# File 'lib/path_mapper/node/file/representation.rb', line 23

def bool
  value == 'yes'
end

#empty?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/path_mapper/node/file/representation.rb', line 5

def empty?
  false
end

#linesObject



27
28
29
# File 'lib/path_mapper/node/file/representation.rb', line 27

def lines
  self.value.lines.map {|l| l.strip }
end

#raw_valueObject



13
14
15
16
17
18
19
20
21
# File 'lib/path_mapper/node/file/representation.rb', line 13

def raw_value
  with_dry_run do |dry_run|
    if dry_run
      self.storage[@path].to_s
    else
      ::File.read(@path)
    end
  end
end

#to_sObject



31
32
33
# File 'lib/path_mapper/node/file/representation.rb', line 31

def to_s
  self.value
end

#valueObject



9
10
11
# File 'lib/path_mapper/node/file/representation.rb', line 9

def value
  self.raw_value.strip
end