Class: Pubid::Ecma::Builder
- Inherits:
-
Object
- Object
- Pubid::Ecma::Builder
- Defined in:
- lib/pubid/ecma/builder.rb
Overview
Turns the Parslet parse tree into a concrete identifier object. The class is chosen by which number key the parser captured.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.build(parsed_data) ⇒ Object
8 9 10 |
# File 'lib/pubid/ecma/builder.rb', line 8 def self.build(parsed_data) new.build(parsed_data) end |
Instance Method Details
#build(data) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/pubid/ecma/builder.rb', line 12 def build(data) if data[:tr_number] Identifiers::TechnicalReport.new(number: data[:tr_number].to_s) elsif data[:mem_number] Identifiers::Memento.new(number: data[:mem_number].to_s) else build_standard(data) end end |