Class: SimpleAMS::Document::Generics

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/simple_ams/document/generics.rb

Direct Known Subclasses

Forms, Links, Metas

Defined Under Namespace

Classes: Generic

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Generics

Returns a new instance of Generics.



8
9
10
11
# File 'lib/simple_ams/document/generics.rb', line 8

def initialize(options)
  @options = options
  @members = options.generics
end

Instance Method Details

#[](key) ⇒ Object



13
14
15
16
17
18
# File 'lib/simple_ams/document/generics.rb', line 13

def [](key)
  found = members.find { |generic| generic.name == key }
  return nil unless found

  with_decorator(found)
end

#any?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/simple_ams/document/generics.rb', line 30

def any?
  members.any?
end

#eachObject



20
21
22
23
24
25
26
27
28
# File 'lib/simple_ams/document/generics.rb', line 20

def each
  return enum_for(:each) unless block_given?

  members.each do |member|
    yield with_decorator(member)
  end

  self
end

#empty?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/simple_ams/document/generics.rb', line 34

def empty?
  members.empty?
end