Class: Sounder::Soundboard
- Inherits:
-
Object
- Object
- Sounder::Soundboard
- Defined in:
- lib/sounder/soundboard.rb
Instance Attribute Summary collapse
-
#root ⇒ Object
Returns the value of attribute root.
-
#version_info ⇒ Object
readonly
Returns the value of attribute version_info.
Instance Method Summary collapse
-
#initialize(sounds:, version_info: "Sounder Soundboard", root: nil) ⇒ Soundboard
constructor
A new instance of Soundboard.
- #run(args) ⇒ Object
Constructor Details
#initialize(sounds:, version_info: "Sounder Soundboard", root: nil) ⇒ Soundboard
Returns a new instance of Soundboard.
6 7 8 9 10 11 |
# File 'lib/sounder/soundboard.rb', line 6 def initialize sounds:, version_info: "Sounder Soundboard", root: nil @soundgroup = {} @version_info = version_info @sounds = sounds @root = root end |
Instance Attribute Details
#root ⇒ Object
Returns the value of attribute root.
4 5 6 |
# File 'lib/sounder/soundboard.rb', line 4 def root @root end |
#version_info ⇒ Object (readonly)
Returns the value of attribute version_info.
3 4 5 |
# File 'lib/sounder/soundboard.rb', line 3 def version_info @version_info end |
Instance Method Details
#run(args) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/sounder/soundboard.rb', line 13 def run args case when random?(args) then soundgroup.random when help?(args) then puts usage when sound?(args) then play_sound(args.join ' ') else puts usage end end |