hash = HashWithIndifferentAccess.new({a: 1}) # { "a" => 1 }
<code lang="ruby">
</code>
arr_hash = HashWithIndifferentAccess.new([{a: 1}]) # { }
[ { "id" => 2 }, { "id" => 3 }, { "id" => 1 } ].map { |v| HashWithIndifferentAccess.new( v ) }.each{ | v | p v[:id] }
# 2
# 3
# 1
document.addEventListener( 'DOMContentLoaded', ( ) => {
const iframe = document.querySelector( 'iframe' );
const canvas = document.querySelector( 'canvas' );
const view = document.querySelector( '.view' );
document.querySelector( '#btn_canvas' ).addEventListener( 'click', ( ) => {
rasterizeHTML
.drawHTML( view.innerHTML )
.then( function success( renderResult ) {
const height = view.clientHeight;
const width = view.clientWidth;
canvas.width = width;
canvas.height = height;
const imgData = canvas.getContext( '2d' ).drawImage( renderResult.image, 10, 10 );
const doc = new jsPDF();
doc.addImage( canvas.toDataURL( 'image/png', 1.0 ), 'PNG', 0, 0, height * 160 / width, 160 );
const pdfText = doc.output( 'datauristring' );
iframe.src = pdfText;
} );
} );
} );