lib.rb

Path: lib.rb
Last Update: Sat May 23 20:21:13 +0200 2009

This file contains definition of class MyHash, data structure needed by ascon.

License: GNU General Public License V2

Author: Lukáš Kerpl

Methods

Public Instance methods

Function clean up before exit.

[Source]

# File lib.rb, line 36
def cleanup()
        $listener = nil
        $speaker = nil
        $collection = nil
end

Function to map spoken numbers from one to ten to digits.

[Source]

# File lib.rb, line 45
def numbers(number)
        case number
        when "one"
                return 1
        when "two"
                return 2
        when "three"
                return 3
        when "four"
                return 4
        when "five"
                return 5
        when "six"
                return 6
        when "seven"
                return 7
        when "eight"
                return 8
        when "nine"
                return 9
        when "ten"
                return 10
        end
end

Save system command function

false if the command exit with code > 0

[Source]

# File lib.rb, line 24
def safe_command(cmd)
        is_ok = `#{cmd} > /dev/null && echo "OK"`.chomp
        if is_ok == "OK"
                return true
        else
                return false
        end
end

[Validate]