Sha256: 0dfedf224ce6ccfb59899f23ed4d2fb0725777f5a21b43c264c242f7716e632e

Contents?: true

Size: 1.18 KB

Versions: 3

Compression:

Stored size: 1.18 KB

Contents

# frozen_string_literal: true

require_relative "rails_toastify/version"
require_relative "rails_toastify/engine"

module RailsToastify
  class << self
    attr_accessor :configuration
  end

  def self.setup
    self.configuration ||= Configuration.new
    yield(configuration)
  end

  class Configuration
    attr_accessor :position, :notice_animation, :alert_animation, :notice_duration, :alert_duration,
    :notice_theme, :alert_theme, :notice_type, :alert_type

    def initialize
      @position = 'toast-container-top-right'
      @notice_animation = 'bounce'
      @alert_animation = 'zoom'
      @notice_duration = 3000
      @alert_duration = 3000
      @notice_theme = 'light'
      @alert_theme = 'light'
      @notice_type = 'default'
      @alert_type = 'error'
    end

    def to_h
      {
        position: @position,
        notice_animation: @notice_animation,
        alert_animation: @alert_animation,
        notice_duration: @notice_duration,
        alert_duration: @alert_duration,
        notice_theme: @notice_theme,
        alert_theme: @alert_theme,
        notice_type: @notice_type,
        alert_type: @alert_type
      }
    end
  end

  class Error < StandardError; end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails_toastify-1.2.2 lib/rails_toastify.rb
rails_toastify-1.2.1 lib/rails_toastify.rb
rails_toastify-1.2.0 lib/rails_toastify.rb