Class: Lastpass::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/lastpass-api/parser.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_string, with_passwords: false) ⇒ Parser

Returns a new instance of Parser.



8
9
10
11
12
# File 'lib/lastpass-api/parser.rb', line 8

def initialize( raw_string, with_passwords: false )
  @raw_string = raw_string
  @with_passwords = with_passwords
  @all = {}
end

Class Method Details

.parse(raw_string, with_passwords: false) ⇒ Object



4
5
6
# File 'lib/lastpass-api/parser.rb', line 4

def self.parse( raw_string, with_passwords: false )
  new( raw_string, with_passwords: with_passwords ).parse_all
end

Instance Method Details

#inspectObject

Hide instance variables and values



22
23
24
25
# File 'lib/lastpass-api/parser.rb', line 22

def inspect
  original_inspect = super
  original_inspect.split( ' ' ).first << '>'
end

#parse_allObject



14
15
16
17
18
19
# File 'lib/lastpass-api/parser.rb', line 14

def parse_all
  @raw_string.split( "\n" ).each do |line|
    parse_line( line )
  end
  @all.values
end