Class: Disposable::Twin::Decorator

Inherits:
Representable::Decorator
  • Object
show all
Defined in:
lib/disposable/twin/representer.rb

Defined Under Namespace

Classes: Definition, Options

Class Method Summary collapse

Class Method Details

.build_configObject

FIXME: this is not properly used when inheriting - fix that in representable.



19
20
21
# File 'lib/disposable/twin/representer.rb', line 19

def self.build_config
  Config.new(Definition)
end

.default_inline_classObject



40
41
42
# File 'lib/disposable/twin/representer.rb', line 40

def self.default_inline_class
  Twin
end

.each(options = {}) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/disposable/twin/representer.rb', line 23

def self.each(options={})
  return representable_attrs[:definitions].values unless block_given?

  definitions = representable_attrs

  definitions.each do |dfn|
    next if options[:exclude]    and options[:exclude].include?(dfn.name)
    next if options[:scalar]     and dfn[:collection]
    next if options[:collection] and ! dfn[:collection]
    next if options[:twin]       and ! dfn[:twin]

    yield dfn
  end

  definitions
end