Class: Gitt::Parsers::Attributer

Inherits:
Object
  • Object
show all
Defined in:
lib/gitt/parsers/attributer.rb

Overview

Extracts attributes from XML formatted content.

Instance Method Summary collapse

Constructor Details

#initialize(keys = Core::EMPTY_ARRAY) ⇒ Attributer

Returns a new instance of Attributer.



9
10
11
# File 'lib/gitt/parsers/attributer.rb', line 9

def initialize keys = Core::EMPTY_ARRAY
  @keys = keys
end

Instance Method Details

#call(content) ⇒ Object



13
14
15
16
17
# File 'lib/gitt/parsers/attributer.rb', line 13

def call content
  build String(content)
rescue ArgumentError => error
  error.message.include?("invalid byte") ? build(content.scrub("?")) : raise
end