Class: RbSys::Mkmf::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/rb_sys/mkmf/config.rb

Overview

Config that delegates to CargoBuilder if needded

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(builder) ⇒ Config

Returns a new instance of Config.



9
10
11
12
13
14
# File 'lib/rb_sys/mkmf/config.rb', line 9

def initialize(builder)
  @builder = builder
  @force_install_rust_toolchain = false
  @auto_install_rust_toolchain = true
  @clean_after_install = rubygems_invoked?
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &blk) ⇒ Object



20
21
22
# File 'lib/rb_sys/mkmf/config.rb', line 20

def method_missing(name, *args, &blk)
  @builder.send(name, *args, &blk)
end

Instance Attribute Details

#auto_install_rust_toolchainObject

Returns the value of attribute auto_install_rust_toolchain.



7
8
9
# File 'lib/rb_sys/mkmf/config.rb', line 7

def auto_install_rust_toolchain
  @auto_install_rust_toolchain
end

#clean_after_installObject

Returns the value of attribute clean_after_install.



7
8
9
# File 'lib/rb_sys/mkmf/config.rb', line 7

def clean_after_install
  @clean_after_install
end

#force_install_rust_toolchainObject

Returns the value of attribute force_install_rust_toolchain.



7
8
9
# File 'lib/rb_sys/mkmf/config.rb', line 7

def force_install_rust_toolchain
  @force_install_rust_toolchain
end

#target_dirObject

Returns the value of attribute target_dir.



7
8
9
# File 'lib/rb_sys/mkmf/config.rb', line 7

def target_dir
  @target_dir
end

Instance Method Details

#cross_compiling?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/rb_sys/mkmf/config.rb', line 16

def cross_compiling?
  RbConfig::CONFIG["CROSS_COMPILING"] == "yes"
end

#respond_to_missing?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/rb_sys/mkmf/config.rb', line 24

def respond_to_missing?(name, include_private = false)
  @builder.respond_to?(name) || super
end

#rubygems_invoked?Boolean

Seems to be the only way to reliably know if we were invoked by Rubygems. We want to know this so we can cleanup the target directory after an install, to remove bloat.

Returns:

  • (Boolean)


31
32
33
# File 'lib/rb_sys/mkmf/config.rb', line 31

def rubygems_invoked?
  ENV.key?("SOURCE_DATE_EPOCH")
end