Module: PatternPatch::Methods
Instance Attribute Summary collapse
-
#patch_dir ⇒ String
Set this to conveniently load patches from a common folder with the patch method.
-
#safe_level ⇒ Object?
Set the default safe level to use with ERb.
-
#trim_mode ⇒ String?
Set the default trim mode to use with ERb.
Instance Method Summary collapse
-
#patch(name) ⇒ Patch
Loads a patch from the patch_dir.
Instance Attribute Details
#patch_dir ⇒ String
Set this to conveniently load patches from a common folder with the patch method.
27 28 29 |
# File 'lib/pattern_patch.rb', line 27 def patch_dir @patch_dir end |
#safe_level ⇒ Object?
Set the default safe level to use with ERb. This is the same as the value of PatternPatch.safe_level.
33 |
# File 'lib/pattern_patch.rb', line 33 def_delegator "PatternPatch", :safe_level, :safe_level |
#trim_mode ⇒ String?
Set the default trim mode to use with ERb. This is the same as the value of PatternPatch.trim_mode.
40 |
# File 'lib/pattern_patch.rb', line 40 def_delegator "PatternPatch", :trim_mode, :trim_mode |
Instance Method Details
#patch(name) ⇒ Patch
Loads a patch from the patch_dir
47 48 49 50 51 |
# File 'lib/pattern_patch.rb', line 47 def patch(name) raise ConfigurationError, "patch_dir has not been set" if patch_dir.nil? raise ConfigurationError, "patch_dir is not a directory" unless Dir.exist?(patch_dir) Patch.from_yaml File.join(patch_dir, "#{name}.yml") end |