Module: Solid::Process::ClassMethods
- Included in:
- Solid::Process
- Defined in:
- lib/solid/process/class_methods.rb
Instance Method Summary collapse
- #dependencies(&block) ⇒ Object (also: #deps)
- #dependencies=(klass) ⇒ Object (also: #deps=)
- #input(&block) ⇒ Object
- #input=(klass) ⇒ Object
Instance Method Details
#dependencies(&block) ⇒ Object Also known as: deps
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/solid/process/class_methods.rb', line 28 def dependencies(&block) return const_get(:Dependencies, false) if const_defined?(:Dependencies, false) return if block.nil? klass = ::Class.new(Config.instance.dependencies_class) klass.class_eval(&block) self.dependencies = klass end |
#dependencies=(klass) ⇒ Object Also known as: deps=
22 23 24 25 26 |
# File 'lib/solid/process/class_methods.rb', line 22 def dependencies=(klass) const_defined?(:Dependencies, false) and raise Error, "#{const_get(:Dependencies, false)} class already defined" const_set(:Dependencies, Config::SolidModel[klass]) end |
#input(&block) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/solid/process/class_methods.rb', line 11 def input(&block) return const_get(:Input, false) if const_defined?(:Input, false) block.nil? and raise Error, "#{self}::Input is undefined. Use #{self}.input { ... } to define it." klass = ::Class.new(Config.instance.input_class) klass.class_eval(&block) self.input = klass end |
#input=(klass) ⇒ Object
5 6 7 8 9 |
# File 'lib/solid/process/class_methods.rb', line 5 def input=(klass) const_defined?(:Input, false) and raise Error, "#{const_get(:Input, false)} class already defined" const_set(:Input, Config::SolidModel[klass]) end |