Class: SimpleAMS::Document::Generics
- Inherits:
-
Object
- Object
- SimpleAMS::Document::Generics
- Includes:
- Enumerable
- Defined in:
- lib/simple_ams/document/generics.rb
Defined Under Namespace
Classes: Generic
Instance Method Summary collapse
- #[](key) ⇒ Object
- #any? ⇒ Boolean
- #each ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(options) ⇒ Generics
constructor
A new instance of Generics.
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 = @members = .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
30 31 32 |
# File 'lib/simple_ams/document/generics.rb', line 30 def any? members.any? end |
#each ⇒ Object
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
34 35 36 |
# File 'lib/simple_ams/document/generics.rb', line 34 def empty? members.empty? end |