Class: Leeloo::LocalFileSystemSecret

Inherits:
Secret
  • Object
show all
Defined in:
lib/leeloo/secret.rb

Direct Known Subclasses

GpgLocalFileSystemSecret

Instance Attribute Summary collapse

Attributes inherited from Secret

#name

Instance Method Summary collapse

Methods inherited from Secret

#==

Constructor Details

#initialize(pathname, name) ⇒ LocalFileSystemSecret

Returns a new instance of LocalFileSystemSecret.



35
36
37
38
# File 'lib/leeloo/secret.rb', line 35

def initialize pathname, name
  super name
  @pathname = pathname
end

Instance Attribute Details

#pathnameObject (readonly)

Returns the value of attribute pathname.



33
34
35
# File 'lib/leeloo/secret.rb', line 33

def pathname
  @pathname
end

Instance Method Details

#eraseObject



49
50
51
# File 'lib/leeloo/secret.rb', line 49

def erase
  File.delete @pathname
end

#readObject



40
41
42
# File 'lib/leeloo/secret.rb', line 40

def read
  File.read @pathname
end

#write(phrase) ⇒ Object



44
45
46
47
# File 'lib/leeloo/secret.rb', line 44

def write phrase
  FileUtils.mkdir_p File.dirname @pathname
  File.write @pathname, phrase
end