Class: Rea::Application::Rails32Reloader

Inherits:
Object
  • Object
show all
Defined in:
lib/rea/application.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rails_app, rea_app, rails_version = "3.2") ⇒ Rails32Reloader

Returns a new instance of Rails32Reloader.



93
94
95
96
97
# File 'lib/rea/application.rb', line 93

def initialize(rails_app, rea_app, rails_version = "3.2")
	@rails_app = rails_app
	@rea_app = rea_app
	@rails_version = rails_version.to_s
end

Instance Attribute Details

#rails_appObject (readonly)

Returns the value of attribute rails_app.



91
92
93
# File 'lib/rea/application.rb', line 91

def rails_app
  @rails_app
end

#rails_versionObject (readonly)

Returns the value of attribute rails_version.



91
92
93
# File 'lib/rea/application.rb', line 91

def rails_version
  @rails_version
end

#rea_appObject (readonly)

Returns the value of attribute rea_app.



91
92
93
# File 'lib/rea/application.rb', line 91

def rea_app
  @rea_app
end

Instance Method Details

#attach!Object



99
100
101
102
103
104
105
106
107
108
109
# File 'lib/rea/application.rb', line 99

def attach!
	rea_app.load_paths.each do |path|
	  rails_app.config.watchable_dirs[path] = [:rb]
	end

	reloader = self

	ActionDispatch::Reloader.to_prepare do
	  reloader.reload!
	end
end

#major_rails_versionObject



116
117
118
# File 'lib/rea/application.rb', line 116

def major_rails_version
	@rails_version[0..2]
end

#reload!Object



111
112
113
114
# File 'lib/rea/application.rb', line 111

def reload!
	rea_app.unload!
	rea_app.load!
end