Module: Cinnabar

Defined in:
lib/cinnabar/00_pre.rb,
lib/cinnabar/path.rb,
lib/cinnabar/path.rb,
lib/cinnabar/utils.rb,
lib/cinnabar/version.rb,
lib/cinnabar/gem_path.rb

Overview

Defined Under Namespace

Modules: Command, Downloader, FnPipe, GemPathCore, StrToPath, Utils Classes: GemPath

Constant Summary collapse

VERSION =
'0.0.8'

Class Method Summary collapse

Class Method Details

.firb_installation_script_pathObject



29
30
31
# File 'lib/cinnabar/path.rb', line 29

def firb_installation_script_path
  File.expand_path('../../misc/firb/install.ps1', Kernel.__dir__)
end

.firb_pathObject



25
26
27
# File 'lib/cinnabar/path.rb', line 25

def firb_path
  File.expand_path('../../misc/firb/bin/', Kernel.__dir__)
end

.new_gem_path_procProc

Returns a factory Proc that builds a GemPath instance.

Behavior

  • The returned Proc accepts a single argument opts.
  • When called, it creates a new GemPath with opts.

Examples:

Build and use a resolver on demand


{
   gems: %w[rdoc logger irb reline fiddle],
   install_gem: true
}.then(&Cinnabar.new_gem_path_proc)
 .append_load_path!

Parameters:

Returns:

  • (Proc)

    a callable object: (opts) -> Cinnabar::GemPath

See Also:



32
# File 'lib/cinnabar/gem_path.rb', line 32

def self.new_gem_path_proc = ->(opts) { Cinnabar::GemPath.new(opts) }

.to_path_procProc

Build a Proc that converts a string value into a Kernel.Pathname.

This is handy when you want to pass a converter into higher-order APIs (e.g., map/filter pipelines).

Examples:

convert a list of directories to Pathname objects


conv = Cinnabar.to_path_proc
%w[/tmp /var].map(&conv)
#=> [#<Pathname:/tmp>, #<Pathname:/var>]

Parameters:

  • s (String, Pathname)

    a path (e.g., file/dir)

Returns:

  • (Proc)

    a lambda that maps s to Pathname(s)



19
# File 'lib/cinnabar/path.rb', line 19

def self.to_path_proc = ->(s) { Pathname(s) }