Class: Curly::AttributeScanner

Inherits:
Object
  • Object
show all
Defined in:
lib/curly/attribute_scanner.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string) ⇒ AttributeScanner


12
13
14
# File 'lib/curly/attribute_scanner.rb', line 12

def initialize(string)
  @scanner = StringScanner.new(string)
end

Class Method Details

.scan(string) ⇒ Object


7
8
9
10
# File 'lib/curly/attribute_scanner.rb', line 7

def self.scan(string)
  return {} if string.nil?
  new(string).scan
end

Instance Method Details

#scanObject


16
17
18
19
# File 'lib/curly/attribute_scanner.rb', line 16

def scan
  attributes = scan_attributes
  Hash[attributes]
end