Class: Pwss::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/pwss/generators/entry.rb

Overview

Entry generates an entry for the password safe It is a wrapper to a Hash

Direct Known Subclasses

BankAccount, Code, CreditCard, Sim, SoftwareLicense

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEntry

Returns a new instance of Entry.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/pwss/generators/entry.rb', line 10

def initialize
  @entry  = Hash.new
  @fields = [
    "title",
    "url",
    "username",
    "password",
    "recovery_email",
    "description"
  ]
end

Instance Attribute Details

#entryObject (readonly)

Returns the value of attribute entry.



7
8
9
# File 'lib/pwss/generators/entry.rb', line 7

def entry
  @entry
end

#fieldsObject (readonly)

Returns the value of attribute fields.



8
9
10
# File 'lib/pwss/generators/entry.rb', line 8

def fields
  @fields
end

Instance Method Details

#ask(arguments = {}) ⇒ Object

interactively ask the fields specified in @fields

optional hash arguments allows to pass arguments to the input-asking functions (including the default value for a key) See the documentation of Pwss::Fields::ask for more details.



28
29
30
31
32
33
# File 'lib/pwss/generators/entry.rb', line 28

def ask arguments = {}
  @entry = Hash.new
  @fields.each do |key|
    @entry[key] = Fields.ask key, arguments
  end
end