Class: Lastpass::Parser Private
- Inherits:
-
Object
- Object
- Lastpass::Parser
- Defined in:
- lib/lastpass-api/parser.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Internal class for parsing through Lastpass raw output
Class Method Summary collapse
-
.parse(raw_string, with_passwords: false) ⇒ Array<Hash>
private
Method to interact directly with parser.
Instance Method Summary collapse
-
#initialize(raw_string, with_passwords: false) ⇒ Parser
constructor
private
A new instance of Parser.
-
#inspect ⇒ Object
private
Hide instance variables and values.
-
#parse_all ⇒ Array<Hash>
private
Parse through all lines in raw output.
Constructor Details
#initialize(raw_string, with_passwords: false) ⇒ Parser
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Parser.
18 19 20 21 22 |
# File 'lib/lastpass-api/parser.rb', line 18 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) ⇒ Array<Hash>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Method to interact directly with parser
13 14 15 |
# File 'lib/lastpass-api/parser.rb', line 13 def self.parse( raw_string, with_passwords: false ) new( raw_string, with_passwords: with_passwords ).parse_all end |
Instance Method Details
#inspect ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Hide instance variables and values
37 38 39 40 |
# File 'lib/lastpass-api/parser.rb', line 37 def inspect original_inspect = super original_inspect.split( ' ' ).first << '>' end |
#parse_all ⇒ Array<Hash>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Parse through all lines in raw output
27 28 29 30 31 32 |
# File 'lib/lastpass-api/parser.rb', line 27 def parse_all @raw_string.split( "\n" ).each do |line| parse_line( line ) end @all.values end |