Class: GemHadar::RvmConfig

Inherits:
Object
  • Object
show all
Extended by:
DSLKit::DSLAccessor
Includes:
DSLKit::BlockSelf
Defined in:
lib/gem_hadar.rb

Overview

A class that encapsulates Ruby Version Manager (RVM) configuration settings for a gem project.

This class is responsible for managing RVM-specific configuration such as the Ruby version to use and the gemset name. It provides a structured way to define and access these settings within the context of a GemHadar configuration.

Examples:

Configuring RVM settings

GemHadar do
  rvm do
    use '3.0.0'
    gemset 'my_gem_dev'
  end
end

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ GemHadar::RvmConfig

The initialize method sets up the RvmConfig instance by evaluating the provided block in the context of the object.

Parameters:

  • block (Proc)

    the block to be evaluated for configuring the RVM settings



601
602
603
604
# File 'lib/gem_hadar.rb', line 601

def initialize(&block)
  @outer_scope = block_self(&block)
  instance_eval(&block)
end

Instance Method Details

#gemsetString

The gemset method retrieves or sets the RVM gemset name for the project.

This method serves as an accessor for the RVM (Ruby Version Manager) gemset configuration within the nested RvmConfig class. When called without arguments, it returns the configured gemset name, which defaults to the gem’s name. When called with an argument, it sets the gemset name to be used with RVM.

Returns:

  • (String)

    the RVM gemset name configured for the project

See Also:



628
# File 'lib/gem_hadar.rb', line 628

dsl_accessor :gemset do @outer_scope.name end

#useString

The use method retrieves or sets the Ruby version to be used with RVM.

This method serves as an accessor for the Ruby version configuration within the RVM (Ruby Version Manager) settings. When called without arguments, it returns the configured Ruby version. When called with an argument, it sets the Ruby version to be used.

Returns:

  • (String)

    the Ruby version string configured for RVM use

See Also:



615
# File 'lib/gem_hadar.rb', line 615

dsl_accessor :use do `rvm tools strings`.split(/\n/).full?(:last) || 'ruby' end