Module: FileOpenUtil
- Included in:
- Mako::Configuration, Mako::HTMLRenderer, Mako::SassRenderer, Mako::SubscriptionListParser, Mako::SubscriptionListWriter
- Defined in:
- lib/mako/file_open_util.rb
Class Method Summary collapse
-
.included(base) ⇒ String
Opens and reads the passed in file.
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ String
Opens and reads the passed in file. Thanks to the following article for explaining how to define a method on the included singleton class: 6ftdan.com/allyourdev/2015/02/24/writing-methods-for-both-class-and-instance-levels/
10 11 12 13 14 |
# File 'lib/mako/file_open_util.rb', line 10 def self.included(base) def base.load_resource(resource) File.open(resource, 'rb', encoding: 'utf-8', &:read) end end |
Instance Method Details
#load_resource(resource) ⇒ Object
16 17 18 |
# File 'lib/mako/file_open_util.rb', line 16 def load_resource(resource) self.class.load_resource(resource) end |