module Nucleon

Nucleon top level module

Any methods contained in this file are purely for enabling early checks or operations needed for loading Nucleon effectively?

Most methods to the Nucleon module should be loaded via the Nucleon::Facade.

Nucleon::Facade extends Nucleon

Public Class Methods

VERSION() click to toggle source

Get currently loaded versioin of Nucleon

This method loads from the VERSION file in the top level directory. This file gets automatically updated as we build and release new versions.

See the Rakefile and the Coral Toolbox project at:

github.com/coralnexus/coral-toolbox

Note: This process might change in the near future.

  • Parameters

  • Returns

    • String

      Currently loaded version of Nucleon framework

  • Errors

    # File lib/nucleon_base.rb
158 def self.VERSION
159   File.read(File.join(File.dirname(__FILE__), '..', 'VERSION'))
160 end
console_lock() click to toggle source

Get the global console Mutex for synchronized console operations.

  • Parameters

  • Returns

    • Mutex

      Console Mutex object

  • Errors

    # File lib/nucleon_base.rb
375 def self.console_lock
376   @@console_lock
377 end
debug_break(condition = true) click to toggle source

Set a debug break poing at the line of invocation if debugging is enabled.

Nucleon uses Pry to perform stepwise debugging through the code.

Note: This is not used very often so it may be buggy in areas.

  • Parameters

    • Boolean

      condition Boolean test to check if the debugging breakpoint should be active

  • Returns

    • Void

      This method does not return a value

  • Errors

See also:

    # File lib/nucleon_base.rb
244   def self.debug_break(condition = true)
245     if debugging?
246 #*******************************************************************************
247 # Nucleon Pry powered development console
248 #
249 # Usage:
250 #
251 # * Execute nucleon (or derivative executable, ex; corl) with the NUCLEON_DEBUG
252 #   environment variable set
253 #
254 #   :> [ sudo ] NUCLEON_DEBUG=1 nucleon <args>...
255 #
256 # * Call the debug_break method anywhere in the code to start a debugging
257 #   session.
258 #
259 #   :> Nucleon.debug_break   or    :> Nucleon.debug_break <test?>
260 #
261 # * Since the debugging tools don't work in parallel, parallel operations are
262 #   serialized when NUCLEON_DEBUG environment variable is found.
263 #
264 #*******************************************************************************
265 # General information
266 #
267 # For more information on Pry: http://pryrepl.org
268 #                              ( https://github.com/pry/pry )
269 #
270 # Loaded plugins: stack explorer ( https://github.com/pry/pry-stack_explorer )
271 #                 debugger       ( https://github.com/nixme/pry-debugger )
272 #
273 # For available commands and help information: [ help ]
274 # For command specific help:                   [ <command> --help ]
275 #
276 #*******************************************************************************
277 # General commands:
278 #
279 # :> cd <Class>                Change to inspect class (class constant)
280 # :> show-method <method>      Show source for class method
281 # :> .<CLI command> <args>...  Execute a CLI command (always starts with dot)
282 #
283 #*******************************************************************************
284 # Breakpoints
285 #
286 # :> breakpoints                             List all defined breakpoints
287 # :> break                                   Same as breakpoints command
288 #
289 # :> break <Class>#<method>                  Break at start of `Class#method`.
290 # :> break <Class>#<method> if <test?>       Break at `Class#method` if `test?`.
291 # :> break <path>/<ruby file>:<line>         Break at line in ruby file.
292 # :> break <line>                            Break at line in current file.
293 #
294 # :> break --condition <breakpoint> <test?>  Change condition on breakpoint.
295 # :> break --condition <breakpoint>          Remove condition on breakpoint.
296 #
297 # :> break --delete <breakpoint>             Delete breakpoint.
298 # :> break --disable-all                     Disable all breakpoints.
299 #
300 # :> break --show <breakpoint>               Show details about breakpoint.
301 #
302 #*******************************************************************************
303 # Stack inspection / traversal
304 #
305 # :> show-stack      Show all accessible frames in the call stack.
306 # :> frame <number>  Move to a specific frame.
307 # :> up              Move up one frame in the call stack.
308 # :> down            Move down one frame in the call stack.
309 #
310 #*******************************************************************************
311 # Debugging execution flow:
312 #
313 # :> s = [ step | step <times> ]  Step execution into the next line or method.
314 # :> n = [ next | next <times> ]  Step over to the next line within same frame.
315 # :> f = [ finish ]               Execute until current stack frame returns.
316 # :> c = [ continue ]             Continue program execution (end Pry session).
317 #
318       binding.pry if condition
319     end
320   end
debugging?() click to toggle source

Check if debugging is enabled

This uses the environment variable *“NUCLEON_DEBUG”*

ENV["NUCLEON_DEBUG"]
  • Parameters

  • Returns

    • Boolean

      Whether or not debugging is enabled

  • Errors

See also:

    # File lib/nucleon_base.rb
223 def self.debugging?
224   ENV["NUCLEON_DEBUG"] ? true : false
225 end
dump_enabled() click to toggle source

Check whether dumping is enabled or disabled through dbg()

  • Parameters

  • Returns

    • Boolean

      Whether or not to enable dumping through dbg()

  • Errors

See also:

    # File lib/nucleon_base.rb
201 def self.dump_enabled
202   @@dump_enabled
203 end
dump_enabled=(dump) click to toggle source

Enable or disable variable dumping through dbg()

  • Parameters

    • Boolean

      dump Whether or not to enable dumping through dbg()

  • Returns

    • Void

      This method does not return a value

  • Errors

See also:

    # File lib/nucleon_base.rb
185 def self.dump_enabled=dump
186   @@dump_enabled = dump
187 end
parallel?() click to toggle source

Check if parallel execution is enabled

This uses the environment variable *“NUCLEON_NO_PARALLEL”*. Parallelism is enabled by default.

ENV["NUCLEON_NO_PARALLEL"]

Due to the complications with parallel debugging, parallel is suspended when debugging is enabled

  • Parameters

  • Returns

    • Boolean

      Whether or not parallel is enabled

  • Errors

See also:

    # File lib/nucleon_base.rb
355 def self.parallel?
356   debugging? || ENV['NUCLEON_NO_PARALLEL'] ? false : true
357 end