Class: ActiveLoader::ContentLoader
- Inherits:
-
Object
- Object
- ActiveLoader::ContentLoader
- Defined in:
- lib/active_loader/content_loader.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(path) ⇒ ContentLoader
constructor
A new instance of ContentLoader.
Constructor Details
#initialize(path) ⇒ ContentLoader
Returns a new instance of ContentLoader.
5 6 7 |
# File 'lib/active_loader/content_loader.rb', line 5 def initialize(path) @path = path end |
Instance Method Details
#call ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/active_loader/content_loader.rb', line 9 def call return default_content unless path if url? require "http" HTTP.get(path).to_s elsif file? IO.read(path) else path end end |