Class: Marley::Joints::Joint

Inherits:
Object
  • Object
show all
Extended by:
Utils::ClassAttrs
Defined in:
lib/marley/joint.rb

Direct Known Subclasses

Forum, Messages, Section, Tags, User

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils::ClassAttrs

class_attr, lazy_class_attrs

Constructor Details

#initialize(opts = {}) ⇒ Joint

Returns a new instance of Joint.



10
11
12
# File 'lib/marley/joint.rb', line 10

def initialize(opts={})
  config(opts)
end

Instance Attribute Details

#optsObject

Returns the value of attribute opts.



9
10
11
# File 'lib/marley/joint.rb', line 9

def opts
  @opts
end

Instance Method Details

#config(opts) ⇒ Object



26
27
28
# File 'lib/marley/joint.rb', line 26

def config(opts)
  @opts=(@opts || self.class.default_opts || {}).merge(opts)
end

#smokeObject



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/marley/joint.rb', line 13

def smoke
  @opts[:required_joints].to_a.each do |j|
    Marley.joint(j)
  end
  resources=self.class::Resources
  resources.constants.each do |resource_name|
    @opts[:plugins].to_a.each do |plugin_name|
      Marley.plugin(plugin_name).apply(resources.const_get(resource_name))
    end
    MR.const_set(resource_name, resources.const_get(resource_name)) unless (@opts[:resources] && ! @opts[:resources].include?(resource_name) )
  end
  self
end