Class: ChuckTesta::GnomeNotify

Inherits:
Object
  • Object
show all
Defined in:
lib/chuck_testar.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ GnomeNotify

Returns a new instance of GnomeNotify.



8
9
10
# File 'lib/chuck_testar.rb', line 8

def initialize params={}
  params.each { |k,v| send("#{k}=", v) }
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



6
7
8
# File 'lib/chuck_testar.rb', line 6

def description
  @description
end

#iconObject

Returns the value of attribute icon.



6
7
8
# File 'lib/chuck_testar.rb', line 6

def icon
  @icon
end

#titleObject

Returns the value of attribute title.



6
7
8
# File 'lib/chuck_testar.rb', line 6

def title
  @title
end

Instance Method Details

#build_paramsObject



12
13
14
# File 'lib/chuck_testar.rb', line 12

def build_params
  "-i #{icon} \"#{title}\" \"#{description}\""
end

#installed?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/chuck_testar.rb', line 20

def installed?
  `which notify-send`.empty? ? false : true
end

#notify!Object



16
17
18
# File 'lib/chuck_testar.rb', line 16

def notify!
  installed? ? `notify-send #{build_params}` : print_hint
end