Module: Jenkins::Plugin::Behavior::BehavesAs

Included in:
Jenkins::Plugin::Behavior, Implementation
Defined in:
lib/jenkins/plugin/behavior.rb

Instance Method Summary collapse

Instance Method Details

#behaves_as(*behaviors) ⇒ Object



88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/jenkins/plugin/behavior.rb', line 88

def behaves_as(*behaviors)
  @_behaviors ||= Set.new
  behaviors.each do |b|
    unless @_behaviors.include? b
      self.extend b::ClassMethods if b.const_defined? :ClassMethods
      self.send(:include, b::InstanceMethods) if b.const_defined? :InstanceMethods
      b.implemented self if self.is_a? Class
      @_behaviors << b
    end
  end
  return @_behaviors
end