Class: Voodoo::Config::Configuration
- Inherits:
-
Object
- Object
- Voodoo::Config::Configuration
- Defined in:
- lib/voodoo/config.rb
Overview
Class that holds configuration parameters
Instance Attribute Summary collapse
-
#default_architecture ⇒ Object
Returns the default architecture for this compiler.
-
#default_format ⇒ Object
Returns the value of attribute default_format.
-
#gas_command ⇒ Object
Returns the value of attribute gas_command.
-
#nasm_command ⇒ Object
Returns the value of attribute nasm_command.
Instance Method Summary collapse
-
#host_architecture ⇒ Object
Returns the architecture of the machine running the program, or nil if that architecture cannot be determined.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
9 10 11 12 13 14 |
# File 'lib/voodoo/config.rb', line 9 def initialize @default_architecture = :auto @default_format = :elf @gas_command = "as" @nasm_command = "nasm" end |
Instance Attribute Details
#default_architecture ⇒ Object
Returns the default architecture for this compiler
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/voodoo/config.rb', line 23 def default_architecture if @default_architecture == :auto # If @default_architecture has been set to :auto, # return the host architecture, falling back to :i386 # if the host architecture cannot be determined host_architecture || :i386 else @default_architecture end end |
#default_format ⇒ Object
Returns the value of attribute default_format.
16 17 18 |
# File 'lib/voodoo/config.rb', line 16 def default_format @default_format end |
#gas_command ⇒ Object
Returns the value of attribute gas_command.
16 17 18 |
# File 'lib/voodoo/config.rb', line 16 def gas_command @gas_command end |
#nasm_command ⇒ Object
Returns the value of attribute nasm_command.
16 17 18 |
# File 'lib/voodoo/config.rb', line 16 def nasm_command @nasm_command end |
Instance Method Details
#host_architecture ⇒ Object
Returns the architecture of the machine running the program, or nil if that architecture cannot be determined
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/voodoo/config.rb', line 36 def host_architecture arch, = RUBY_PLATFORM.split '-' case arch when 'x86_64', 'amd64' :amd64 when 'arm' :arm when 'i386', 'i686' :i386 when 'mips' :mips when 'mipsel' :mipsel else nil end end |