Module: PushType::Unexposable::ClassMethods

Defined in:
app/models/concerns/push_type/unexposable.rb

Instance Method Summary collapse

Instance Method Details

#descendants(opts = {}) ⇒ Object



17
18
19
20
21
22
23
# File 'app/models/concerns/push_type/unexposable.rb', line 17

def descendants(opts = {})
  if opts.has_key? :exposed
    super().select { |d| !opts[:exposed] == PushType.send(unexposure_method).include?(d.name.underscore) }
  else
    super()
  end
end

#exposed?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'app/models/concerns/push_type/unexposable.rb', line 39

def exposed?
  !unexposed_classes.include?(self)
end

#unexpose!Object



35
36
37
# File 'app/models/concerns/push_type/unexposable.rb', line 35

def unexpose!
  PushType.config.send(unexposure_method).push(self.name.underscore.to_sym).uniq!
end

#unexposed_classesObject



25
26
27
# File 'app/models/concerns/push_type/unexposable.rb', line 25

def unexposed_classes
  _ct.base_class.descendants(exposed: false)
end

#unexposure_methodObject



29
30
31
32
33
# File 'app/models/concerns/push_type/unexposable.rb', line 29

def unexposure_method
  case _ct.base_class.name.demodulize
    when 'Node' then :unexposed_nodes
  end
end