Module: Eapi::List

Extended by:
Common
Includes:
Comparable, Enumerable
Defined in:
lib/eapi/list.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.add_features(klass) ⇒ Object



13
14
15
16
17
# File 'lib/eapi/list.rb', line 13

def self.add_features(klass)
  Eapi::Common.add_features klass
  klass.extend(ClassMethods)
  klass.extend(Eapi::Methods::Properties::ListCLassMethods)
end

.extended(mod) ⇒ Object



19
20
21
22
23
# File 'lib/eapi/list.rb', line 19

def self.extended(mod)
  def mod.included(klass)
    Eapi::List.add_features klass
  end
end

.included(klass) ⇒ Object



25
26
27
# File 'lib/eapi/list.rb', line 25

def self.included(klass)
  Eapi::List.add_features klass
end

Instance Method Details

#<=>(other) ⇒ Object



50
51
52
# File 'lib/eapi/list.rb', line 50

def <=>(other)
  (_list <=> other) || (other.respond_to?(:_list) && _list <=> other._list)
end

#_listObject



41
42
43
# File 'lib/eapi/list.rb', line 41

def _list
  @_list ||= []
end

#add(value) ⇒ Object



45
46
47
48
# File 'lib/eapi/list.rb', line 45

def add(value)
  self << value
  self
end

#is_multiple?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/eapi/list.rb', line 29

def is_multiple?
  true
end

#perform_renderObject



37
38
39
# File 'lib/eapi/list.rb', line 37

def perform_render
  _list.map { |val| convert_value val }.reject { |x| to_be_ignored x }
end

#to_aObject



33
34
35
# File 'lib/eapi/list.rb', line 33

def to_a
  render
end