Module: ProtectedParent::ClassMethods

Defined in:
lib/protected_parent/protected_parent_of.rb

Instance Method Summary collapse

Instance Method Details

#children_of_protected_parentObject



21
22
23
# File 'lib/protected_parent/protected_parent_of.rb', line 21

def children_of_protected_parent
  @children_of_protected_parent ||= []
end

#protected_parent_of(*children_names) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/protected_parent/protected_parent_of.rb', line 10

def protected_parent_of(*children_names)

  @softly_protected = children_names.extract_options!.delete(:protects) == :softly

  children_names.each do |child_name|
    self.children_of_protected_parent << child_name.to_s
  end

  before_destroy :removable?
end

#softly_protectedObject



25
26
27
# File 'lib/protected_parent/protected_parent_of.rb', line 25

def softly_protected
  @softly_protected
end