Class: Fattr::List

Inherits:
Array show all
Defined in:
lib/fattr.rb

Instance Method Summary collapse

Instance Method Details

#<<(element) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/fattr.rb', line 6

def << element
  super
  self
ensure
  uniq!
  index!
end

#include?(element) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
22
# File 'lib/fattr.rb', line 19

def include?(element)
  @index ||= Hash.new
  @index[element.to_s] ? true : false
end

#index!Object



14
15
16
17
# File 'lib/fattr.rb', line 14

def index!
  @index ||= Hash.new
  each{|element| @index[element.to_s] = true}
end

#initializersObject



24
25
26
# File 'lib/fattr.rb', line 24

def initializers
  @initializers ||= Hash.new
end