Class: Docs::FilterStack

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/docs/core/filter_stack.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filters = nil) ⇒ FilterStack

Returns a new instance of FilterStack


8
9
10
# File 'lib/docs/core/filter_stack.rb', line 8

def initialize(filters = nil)
  @filters = filters ? filters.dup : []
end

Instance Attribute Details

#filtersObject (readonly)

Returns the value of attribute filters


6
7
8
# File 'lib/docs/core/filter_stack.rb', line 6

def filters
  @filters
end

Instance Method Details

#==(other) ⇒ Object


30
31
32
# File 'lib/docs/core/filter_stack.rb', line 30

def ==(other)
  other.is_a?(self.class) && filters == other.filters
end

#inheritable_copyObject


38
39
40
# File 'lib/docs/core/filter_stack.rb', line 38

def inheritable_copy
  self.class.new @filters
end

#insert(index, *names) ⇒ Object Also known as: insert_before


16
17
18
# File 'lib/docs/core/filter_stack.rb', line 16

def insert(index, *names)
  @filters.insert assert_index(index), *filter_const(names)
end

#insert_after(index, *names) ⇒ Object


22
23
24
# File 'lib/docs/core/filter_stack.rb', line 22

def insert_after(index, *names)
  insert assert_index(index) + 1, *names
end

#push(*names) ⇒ Object


12
13
14
# File 'lib/docs/core/filter_stack.rb', line 12

def push(*names)
  @filters.push *filter_const(names)
end

#replace(index, name) ⇒ Object


26
27
28
# File 'lib/docs/core/filter_stack.rb', line 26

def replace(index, name)
  @filters[assert_index(index)] = filter_const(name)
end

#to_aObject


34
35
36
# File 'lib/docs/core/filter_stack.rb', line 34

def to_a
  @filters.dup
end