Class: Uberpass::CLI::ShowDecorator
- Inherits:
-
Object
- Object
- Uberpass::CLI::ShowDecorator
- Defined in:
- lib/uberpass/cli.rb
Instance Method Summary collapse
-
#initialize(terminal, entry) ⇒ ShowDecorator
constructor
A new instance of ShowDecorator.
- #output ⇒ Object
- #output_entry(key, values) ⇒ Object
Constructor Details
#initialize(terminal, entry) ⇒ ShowDecorator
Returns a new instance of ShowDecorator.
241 242 243 |
# File 'lib/uberpass/cli.rb', line 241 def initialize terminal, entry @terminal, @entry = terminal, entry end |
Instance Method Details
#output ⇒ Object
245 246 247 248 |
# File 'lib/uberpass/cli.rb', line 245 def output key = @entry.keys.first output_entry key, @entry[key] end |
#output_entry(key, values) ⇒ Object
250 251 252 253 254 255 256 257 258 259 260 |
# File 'lib/uberpass/cli.rb', line 250 def output_entry(key, values) if values.nil? out = "<%= color('#{key} does not exist', :error) %>" else out = "<%= color('#{values["created_at"]}', :date) %>" out << " <%= color('#{key}', :name) %>\n" out << "<%= color('#{values["password"]}', :name) %>" end @terminal.say out end |