Module: Kernel
- Defined in:
- lib/courtier/core_ext.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#import(feature) ⇒ Object
Evaluate script directly into current scope.
-
#import_relative(file) ⇒ Object
Evaluate script directly into current scope.
Class Method Details
.required(feature) ⇒ Object
257 258 259 260 261 262 263 264 265 266 267 268 |
# File 'lib/courtier/interface.rb', line 257 def Kernel.required(feature) config = Courtier.configuration[feature] if config setup = Courtier.court(feature) # FIXME: how to differentiate feature from command setup ? config.each do |config| next unless config.onload? # only command config next unless config.apply? setup ? setup.call(config) : config.call end end super(feature) if defined?(super) end |
Instance Method Details
#import(feature) ⇒ Object
Evaluate script directly into current scope.
5 6 7 8 9 |
# File 'lib/courtier/core_ext.rb', line 5 def import(feature) file = Find.load_path(feature).first raise LoadError, "no such file -- #{feature}" unless file instance_eval(::File.read(file), file) if file end |
#import_relative(file) ⇒ Object
Evaluate script directly into current scope.
14 15 16 17 |
# File 'lib/courtier/core_ext.rb', line 14 def import_relative(file) raise LoadError, "no such file -- #{file}" unless File.file?(file) instance_eval(::File.read(file), file) if file end |