Class: Shiba::Parsers::PostgresExplainIndexConditions
- Inherits:
-
Object
- Object
- Shiba::Parsers::PostgresExplainIndexConditions
- Defined in:
- lib/shiba/parsers/postgres_explain_index_conditions.rb
Instance Attribute Summary collapse
-
#sc ⇒ Object
readonly
Returns the value of attribute sc.
Instance Method Summary collapse
- #fields ⇒ Object
-
#initialize(string) ⇒ PostgresExplainIndexConditions
constructor
A new instance of PostgresExplainIndexConditions.
- #join_fields ⇒ Object
- #parse! ⇒ Object
Constructor Details
#initialize(string) ⇒ PostgresExplainIndexConditions
Returns a new instance of PostgresExplainIndexConditions.
7 8 9 10 11 |
# File 'lib/shiba/parsers/postgres_explain_index_conditions.rb', line 7 def initialize(string) @string = string @sc = ShibaStringScanner.new(string) @fields = nil end |
Instance Attribute Details
#sc ⇒ Object (readonly)
Returns the value of attribute sc.
13 14 15 |
# File 'lib/shiba/parsers/postgres_explain_index_conditions.rb', line 13 def sc @sc end |
Instance Method Details
#fields ⇒ Object
30 31 32 33 |
# File 'lib/shiba/parsers/postgres_explain_index_conditions.rb', line 30 def fields parse! @fields[nil] end |
#join_fields ⇒ Object
35 36 37 38 |
# File 'lib/shiba/parsers/postgres_explain_index_conditions.rb', line 35 def join_fields parse! @fields end |
#parse! ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/shiba/parsers/postgres_explain_index_conditions.rb', line 14 def parse! return if @fields @fields = {} sc.scan(LPAREN) if sc.peek(1) == "(" && !sc.match?(/\(\w+\)::/) while sc.peek(1) == "(" sc.getch extract_field(sc) sc.scan(/\s+AND\s+/) end else extract_field(sc) end end |