Class: Zemu::Config
- Inherits:
-
ConfigObject
- Object
- ConfigObject
- Zemu::Config
- Defined in:
- lib/zemu/config.rb
Overview
Configuration object.
An object which represents the configuration of a Zemu emulator.
Defined Under Namespace
Classes: BlockDrive, BusDevice, Memory, RAM, ROM, SerialPort, Timer
Instance Attribute Summary collapse
-
#devices ⇒ Object
readonly
The bus devices of this configuration object.
Instance Method Summary collapse
-
#add_device(device) ⇒ Object
Adds a new device to the bus for this configuration.
-
#add_io(io) ⇒ Object
Adds a new IO device to this configuration.
-
#add_memory(mem) ⇒ Object
Adds a new memory section to this configuration.
-
#get_binding ⇒ Object
Gets a binding for this object.
-
#initialize ⇒ Config
constructor
Constructor.
-
#params ⇒ Object
Parameters accessible by this configuration object.
-
#params_init ⇒ Object
Initial value for parameters of this configuration object.
Methods inherited from ConfigObject
Constructor Details
#initialize ⇒ Config
Constructor.
Takes a block in which parameters of the configuration can be initialized.
All parameters can be set within this block. They become readonly as soon as the block completes.
767 768 769 770 771 772 773 774 775 776 777 778 779 |
# File 'lib/zemu/config.rb', line 767 def initialize @devices = [] super if @name.empty? raise ConfigError, "The name parameter of a Zemu::Config configuration object cannot be empty." end if /\s/ =~ @name raise ConfigError, "The name parameter of a Zemu::Config configuration object cannot contain whitespace." end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Zemu::ConfigObject
Instance Attribute Details
#devices ⇒ Object (readonly)
The bus devices of this configuration object.
729 730 731 |
# File 'lib/zemu/config.rb', line 729 def devices @devices end |
Instance Method Details
#add_device(device) ⇒ Object
Adds a new device to the bus for this configuration.
804 805 806 |
# File 'lib/zemu/config.rb', line 804 def add_device(device) @devices << device end |
#add_io(io) ⇒ Object
Adds a new IO device to this configuration.
Deprecated - retained only for backwards compatibility. Use add_device instead.
797 798 799 |
# File 'lib/zemu/config.rb', line 797 def add_io(io) @devices << io end |
#add_memory(mem) ⇒ Object
Adds a new memory section to this configuration.
Deprecated - retained only for backwards compatibility. Use add_device instead.
787 788 789 |
# File 'lib/zemu/config.rb', line 787 def add_memory(mem) @devices << mem end |
#get_binding ⇒ Object
Gets a binding for this object.
724 725 726 |
# File 'lib/zemu/config.rb', line 724 def get_binding return binding end |
#params ⇒ Object
Parameters accessible by this configuration object.
732 733 734 |
# File 'lib/zemu/config.rb', line 732 def params return %w(name compiler output_directory clock_speed serial_delay) end |
#params_init ⇒ Object
Initial value for parameters of this configuration object.
737 738 739 740 741 742 743 744 |
# File 'lib/zemu/config.rb', line 737 def params_init return { "compiler" => "clang", "output_directory" => "bin", "clock_speed" => 0, "serial_delay" => 0 } end |