Class: Attributes::List

Inherits:
Array
  • Object
show all
Defined in:
lib/bj/attributes.rb

Instance Method Summary collapse

Instance Method Details

#<<(element) ⇒ Object



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

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

#include?(element) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
20
# File 'lib/bj/attributes.rb', line 17

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

#index!Object



13
14
15
16
# File 'lib/bj/attributes.rb', line 13

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

#initializersObject



21
22
23
# File 'lib/bj/attributes.rb', line 21

def initializers
  @initializers ||= Hash.new
end