Sha256: 57541ec832e782f66d16d88be31d74f61732d99ecc197b7e0aadc2c5a57da61c
Contents?: true
Size: 1.13 KB
Versions: 24
Compression:
Stored size: 1.13 KB
Contents
require File.dirname(__FILE__) + "/resource" module PoolParty def available_custom_resources $available_custom_resources ||= [] end module Resources def call_custom_function(str, opts={}, parent=self, &block) add_resource(:call_function, opts.merge({:str => str, :name => str.keyerize}), parent, &block) end # Resources for function call class CallFunction < Resource def to_string(pre="") returning Array.new do |arr| arr << "#{pre}#{str}" end.join("\n") end end class CustomResource < Resource def self.inherited(subclass) PoolParty::Resources.available_custom_resources << subclass super end def to_string(pre="") returning Array.new do |output| output << "#{pre} # Custom Functions\n" output << self.class.custom_functions_to_string(pre) end.join("\n") end end # Stub methods # TODO: Find a better solution def custom_function(*args, &block) end def self.custom_function(*args, &block) end end end
Version data entries
24 entries across 24 versions & 2 rubygems