Class: Pansophy::Local::File

Inherits:
Object
  • Object
show all
Includes:
Adamantium::Flat
Defined in:
lib/pansophy/local/file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ File

Returns a new instance of File.



8
9
10
# File 'lib/pansophy/local/file.rb', line 8

def initialize(path)
  @pathname = Pathname.new(path)
end

Instance Attribute Details

#pathnameObject (readonly)

Returns the value of attribute pathname.



6
7
8
# File 'lib/pansophy/local/file.rb', line 6

def pathname
  @pathname
end

Instance Method Details

#bodyObject



12
13
14
15
# File 'lib/pansophy/local/file.rb', line 12

def body
  return nil unless @pathname.exist?
  ::File.read(@pathname)
end