Class: Leeloo::GitSecretDecorator

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

Instance Method Summary collapse

Methods inherited from Secret

#==

Constructor Details

#initialize(git, secret) ⇒ GitSecretDecorator

Returns a new instance of GitSecretDecorator.



78
79
80
81
# File 'lib/leeloo/secret.rb', line 78

def initialize git, secret
  @git = git
  @secret = secret
end

Instance Method Details

#eraseObject



97
98
99
100
101
# File 'lib/leeloo/secret.rb', line 97

def erase
  @secret.erase
  @git.remove @secret.pathname
  @git.commit "secret #{@secret.name} removed"
end

#nameObject



83
84
85
# File 'lib/leeloo/secret.rb', line 83

def name
  @secret.name
end

#readObject



87
88
89
# File 'lib/leeloo/secret.rb', line 87

def read
  @secret.read
end

#write(phrase) ⇒ Object



91
92
93
94
95
# File 'lib/leeloo/secret.rb', line 91

def write phrase
  @secret.write phrase
  @git.add @secret.pathname
  @git.commit "secret #{@secret.name} added"
end