Module: Sweetify

Defined in:
lib/sweetify/engine.rb,
lib/sweetify/render.rb,
lib/sweetify/version.rb,
lib/sweetify/sweetalert.rb

Defined Under Namespace

Modules: SweetAlert Classes: Engine

Constant Summary collapse

VERSION =
'2.0.0'.freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.sweetalert_libraryObject



5
6
7
# File 'lib/sweetify/render.rb', line 5

def sweetalert_library
  @sweetalert_library || 'sweetalert2'
end

Class Method Details

.render(json) ⇒ Object



9
10
11
# File 'lib/sweetify/render.rb', line 9

def render(json)
  (sweetalert_library == 'sweetalert2' ? "Swal.fire(#{json})" : "swal(#{json})").html_safe
end