Class: Yap::Addon::RcFile

Inherits:
Base
  • Object
show all
Defined in:
lib/yap/addon/rc_file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

addon_name, export_as, #export_as, load_addon, logger, #logger, #yap_enabled?

Constructor Details

#initialize(file) ⇒ RcFile

Returns a new instance of RcFile.



6
7
8
9
# File 'lib/yap/addon/rc_file.rb', line 6

def initialize(file)
  super(enabled: true)
  @file = File.expand_path(file)
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



4
5
6
# File 'lib/yap/addon/rc_file.rb', line 4

def file
  @file
end

Instance Method Details

#addon_nameObject



11
12
13
# File 'lib/yap/addon/rc_file.rb', line 11

def addon_name
  @file
end

#initialize_world(world) ⇒ Object



15
16
17
18
# File 'lib/yap/addon/rc_file.rb', line 15

def initialize_world(world)
  Treefell['shell'].puts "initializing rcfile: #{file}"
  world.instance_eval File.read(@file), @file
end