Class: Rubyists::Opr::Commands::List::Items
- Inherits:
-
Rubyists::Opr::Command
- Object
- Rubyists::Opr::Command
- Rubyists::Opr::Commands::List::Items
- Defined in:
- lib/rubyists::opr/commands/list/items.rb
Overview
Items subcommand
Instance Attribute Summary collapse
-
#vault ⇒ Object
readonly
Returns the value of attribute vault.
Attributes inherited from Rubyists::Opr::Command
Instance Method Summary collapse
-
#execute(input: $stdin, output: $stdout) ⇒ Object
rubocop:disable Lint/UnusedMethodArgument.
-
#initialize(vault, options) ⇒ Items
constructor
A new instance of Items.
Methods inherited from Rubyists::Opr::Command
#command, #cursor, #editor, #exec_exist?, #generator, #pager, #platform, #prompt, #screen, #which
Constructor Details
#initialize(vault, options) ⇒ Items
Returns a new instance of Items.
12 13 14 15 |
# File 'lib/rubyists::opr/commands/list/items.rb', line 12 def initialize(vault, ) @vault = vault @options = end |
Instance Attribute Details
#vault ⇒ Object (readonly)
Returns the value of attribute vault.
11 12 13 |
# File 'lib/rubyists::opr/commands/list/items.rb', line 11 def vault @vault end |
Instance Method Details
#execute(input: $stdin, output: $stdout) ⇒ Object
rubocop:disable Lint/UnusedMethodArgument
17 18 19 20 21 22 23 24 |
# File 'lib/rubyists::opr/commands/list/items.rb', line 17 def execute(input: $stdin, output: $stdout) # rubocop:disable Lint/UnusedMethodArgument if vault.nil? warn 'Using vault "Private" since none was given' @vault = 'Private' end # Command logic goes here ... Opr.with_login { output.puts Vault.find_by_name(vault).items.map(&:title) } end |