Module: Signum
- Defined in:
- app/components/signum/notification/component.rb,
lib/signum.rb,
lib/signum/engine.rb,
lib/signum/version.rb,
app/models/signum/signal.rb,
lib/signum/configuration.rb,
app/jobs/signum/application_job.rb,
lib/signum/active_record_helpers.rb,
app/models/signum/application_record.rb,
app/controllers/signum/api_controller.rb,
app/helpers/signum/application_helper.rb,
app/mailers/signum/application_mailer.rb,
lib/generators/signum/install_generator.rb,
app/controllers/signum/signal_controller.rb,
app/controllers/signum/application_controller.rb,
lib/generators/signum/tailwind_config_generator.rb,
app/components/signum/notification_body/component.rb,
app/components/signum/notification_drawer/component.rb,
app/components/signum/notification_drawer_item/component.rb
Overview
Defined Under Namespace
Modules: ActiveRecordHelpers, ApplicationHelper, Configurable, Generators, Notification, NotificationBody, NotificationDrawer, NotificationDrawerItem, Options Classes: ApiController, ApplicationController, ApplicationJob, ApplicationMailer, ApplicationRecord, Configuration, Engine, Error, InstallGenerator, Signal, SignalController
Constant Summary collapse
- VERSION =
"0.4.11"
Class Method Summary collapse
- .config ⇒ Object
-
.error(signalable, options) ⇒ Object
Signal about an error.
-
.info(signalable, options) ⇒ Object
Signal about something that happened.
- .setup {|config| ... } ⇒ Object
-
.signal(signalable_receiver, options) ⇒ Object
Generic notice.
-
.success(signalable, options) ⇒ Object
Signal about something that went sucessfully.
-
.warning(signalable, options) ⇒ Object
Signal about something that could go wrong.
Class Method Details
.config ⇒ Object
10 11 12 |
# File 'lib/signum.rb', line 10 def config @config ||= Configuration.new end |
.error(signalable, options) ⇒ Object
Signal about an error
44 45 46 47 48 |
# File 'lib/signum.rb', line 44 def error(signalable, ) return unless signalable signal(signalable, .merge(kind: 'error', icon: Signum.config.icons[:error])) end |
.info(signalable, options) ⇒ Object
Signal about something that happened
37 38 39 40 41 |
# File 'lib/signum.rb', line 37 def info(signalable, ) return unless signalable signal(signalable, .merge(kind: 'info', icon: Signum.config.icons[:info])) end |
.setup {|config| ... } ⇒ Object
14 15 16 17 |
# File 'lib/signum.rb', line 14 def setup @config = Configuration.new yield config end |
.signal(signalable_receiver, options) ⇒ Object
Generic notice
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/signum.rb', line 24 def signal(signalable_receiver, ) return unless signalable_receiver if signalable_receiver.is_a?(Signum.config.user_model_name.constantize) signalable_receiver.signals.create!() elsif signalable_receiver.respond_to?(:each) signalable_receiver.each { |signalable| signal(signalable, ) } nil end end |
.success(signalable, options) ⇒ Object
Signal about something that went sucessfully
51 52 53 54 55 |
# File 'lib/signum.rb', line 51 def success(signalable, ) return unless signalable signal(signalable, .merge(kind: 'success', icon: Signum.config.icons[:success])) end |
.warning(signalable, options) ⇒ Object
Signal about something that could go wrong
58 59 60 61 62 |
# File 'lib/signum.rb', line 58 def warning(signalable, ) return unless signalable signal(signalable, .merge(kind: 'warning', icon: Signum.config.icons[:warning])) end |