Module: Opal::SourceMap::Map
Instance Method Summary collapse
- #as_json ⇒ Object
-
#cache ⇒ Object
Marshaling for cache shortpath.
- #marshal_dump ⇒ Object
- #marshal_load(value) ⇒ Object
- #to_data_uri_comment ⇒ Object
- #to_h ⇒ Object
- #to_json ⇒ Object
- #to_s ⇒ Object
Instance Method Details
#as_json ⇒ Object
23 24 25 |
# File 'lib/opal/source_map/map.rb', line 23 def as_json(*) to_h end |
#cache ⇒ Object
Marshaling for cache shortpath
36 37 38 39 |
# File 'lib/opal/source_map/map.rb', line 36 def cache @to_h ||= map self end |
#marshal_dump ⇒ Object
41 42 43 |
# File 'lib/opal/source_map/map.rb', line 41 def marshal_dump [to_h, generated_code] end |
#marshal_load(value) ⇒ Object
45 46 47 |
# File 'lib/opal/source_map/map.rb', line 45 def marshal_load(value) @to_h, @generated_code = value end |
#to_data_uri_comment ⇒ Object
31 32 33 |
# File 'lib/opal/source_map/map.rb', line 31 def to_data_uri_comment "//# sourceMappingURL=data:application/json;base64,#{Base64.encode64(to_json).delete("\n")}" end |
#to_h ⇒ Object
7 8 9 |
# File 'lib/opal/source_map/map.rb', line 7 def to_h @to_h || map end |
#to_json ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/opal/source_map/map.rb', line 11 def to_json map = to_h map.to_json rescue Encoding::UndefinedConversionError map[:sections].each do |i| i.to_json rescue Encoding::UndefinedConversionError map[:sections].delete(i) end map.to_json end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/opal/source_map/map.rb', line 27 def to_s to_h.to_s end |