Class: Leeloo::ClipboardOutputDecorator

Inherits:
Output
  • Object
show all
Defined in:
lib/leeloo/output.rb

Instance Method Summary collapse

Methods inherited from Output

#render_keys, #render_name_and_secret

Constructor Details

#initialize(output) ⇒ ClipboardOutputDecorator

Returns a new instance of ClipboardOutputDecorator.



131
132
133
# File 'lib/leeloo/output.rb', line 131

def initialize output
    @output = output
end

Instance Method Details

#render_footprint(footprint) ⇒ Object



166
167
168
# File 'lib/leeloo/output.rb', line 166

def render_footprint footprint
    @output.render_footprint footprint
end

#render_preferences(preferences) ⇒ Object



135
136
137
# File 'lib/leeloo/output.rb', line 135

def render_preferences preferences
    @output.render_preferences preferences
end

#render_secret(secret) ⇒ Object



147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/leeloo/output.rb', line 147

def render_secret secret

    Signal.trap("INT") do
        Clipboard.clear
        abort "cleared"
    end

    Clipboard.copy secret.read
    wait = Thread.new do
       puts "cleaning in 30s"
       30.times {
           print "."
           sleep 1
       }
    end
    wait.join
    Clipboard.clear
end

#render_secrets(secrets) ⇒ Object



139
140
141
# File 'lib/leeloo/output.rb', line 139

def render_secrets secrets
    @output.render_secrets secrets
end

#render_share(footprint) ⇒ Object



170
171
172
# File 'lib/leeloo/output.rb', line 170

def render_share footprint
    @output.render_share footprint
end

#render_text(text) ⇒ Object



143
144
145
# File 'lib/leeloo/output.rb', line 143

def render_text text
    @output.render_text text
end