November 14, 2009

Multiprogramming in Ruby

Multiprogramming is the writing of computer programs that write or manipulate other programs as their data.


class Device
def initialize(device_id, data_resource)
@id = device_id
@data_resource = data_resource
end

def display_device
mode = @data_resource.get_display_device_mode(@id)
presets = @data_resource.get_display_device_presets(@id)
summary = "display_device: #{mode} ($#{presets})"
return "* #{summary}" if presets == "XTC909"
summary
end

def chip
mode = @data_resource.get_chip_mode(@id)
presets = @data_resource.get_chip_presets(@id)
summary = "chip: #{mode} ($#{presets})"
return "* #{summary}" if presets == "XTC909"
summary
end

def input_device
mode = @data_resource.get_input_device_mode(@id)
presets = @data_resource.get_input_device_presets(@id)
summary = "input_device: #{mode} ($#{presets})"
return "* #{summary}" if presets == "XTC909"
summary
end

end

No comments:

Post a Comment