class Object

Public Instance Methods

exec(execution) click to toggle source
# File lib/magma.rb, line 27
def exec(execution)
        execc=(eval("`"+execution+"`") or eval("%x("+execution+")"))
                puts execc
        return execc
end
magmaversion() click to toggle source
# File lib/magma.rb, line 1
def magmaversion
        return '0.2.5'
end
magtutor() click to toggle source
# File lib/magma.rb, line 4
def magtutor
        tutorline=<<-'FINISH'
        Hello there, and welcome to Magma. This is Magma tutor. It is a built-in tutorial to help you understand Magma. Let us begin.

        =============1.   Setup=============
                To start up Magma in a Ruby script, add a line to the top of the script, like this:
                                require "magma"; #< Semicolon unnessary, but helps in .min.rb files
                After that line, we must test magma. Check the value of the Magma? environment variable to do so. If the value returned is true, then magma is ready. If the value returned is                  nil, then Magma has an error, and is not ready. Use this code to get a boolean (true or false) value for if Magma is ready:
                                if (ENV["magma?"]==true) then;return true; else; return false; end
                Now that we know that magma is ready, we can start! Proceed to part 2.
        =============2.  CommandLine========
                It is important to know that Magma is completely Ruby code. But using Magma, you can run shell scripts! Using magma, you can execute shell script commands, and see and check               their outcomes. A built-in object called CommandLine exists when Magma is ready. This               object contains methods for accessing command line info. Try running this:
                        CommandLine.execute('ls')
                If you are familiar with the Unix ls command, remember that it lists all files in the current directory. When running the code above, you will see the files, in Ruby! It will           also return the files, [but in an unorganized string, which can be organized into an               array later]. Also, if you would like to find what Command Line Viewer program (aka Command Prompt, Mac Terminal, iTerm, etc) the user is running, use this command:
                        CommandLine.program()
                                
        
        
        
        FINISH
        puts tutorline; puts "\n\n"; return tutorLine
end