Class: Flumtter::Toast

Inherits:
Object
  • Object
show all
Defined in:
lib/flumtter/app/core/toast.rb

Instance Method Summary collapse

Constructor Details

#initialize(msg) ⇒ Toast

Returns a new instance of Toast.



5
6
7
8
9
10
11
12
# File 'lib/flumtter/app/core/toast.rb', line 5

def initialize(msg)
  @msg = msg
  @options = {title: TITLE}
  if block_given?
    yield(self)
    show
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/flumtter/app/core/toast.rb', line 18

def method_missing(method, *args)
  if args.size == 1
    @options[method] = args.first
  else
    super
  end
end

Instance Method Details

#showObject



14
15
16
# File 'lib/flumtter/app/core/toast.rb', line 14

def show
  TerminalNotifier.notify(@msg, @options) if Setting[:toast?]
end