Class: Pubid::Cie::Builder
- Inherits:
-
Object
- Object
- Pubid::Cie::Builder
- Defined in:
- lib/pubid/cie/builder.rb
Overview
Builder transforms parsed data into CIE identifier objects Single Responsibility: Object construction from parse tree
Instance Method Summary collapse
-
#build(parsed_hash, original_string: nil) ⇒ Object
Build identifier from parsed hash.
-
#initialize ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize ⇒ Builder
Returns a new instance of Builder.
8 9 10 |
# File 'lib/pubid/cie/builder.rb', line 8 def initialize # Builder doesn't need scheme for CIE (simpler than ISO/IEC) end |
Instance Method Details
#build(parsed_hash, original_string: nil) ⇒ Object
Build identifier from parsed hash
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/pubid/cie/builder.rb', line 13 def build(parsed_hash, original_string: nil) # Determine identifier class based on parsed content identifier_class = determine_class(parsed_hash) # Extract attributes with style detection attributes = extract_attributes(parsed_hash) # For Bundle identifier, store original string if parsed_hash[:bundle_items] && original_string attributes[:identifiers_string] = original_string end # Construct identifier identifier_class.new(**attributes) end |