Class: YeshuaCrm::Liquid::CellsDrop

Inherits:
Liquid::Drop
  • Object
show all
Defined in:
lib/yeshua_crm/liquid/drops/cells_drop.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cells) ⇒ CellsDrop

Returns a new instance of CellsDrop.



9
10
11
# File 'lib/yeshua_crm/liquid/drops/cells_drop.rb', line 9

def initialize(cells)
  @cells = cells
end

Class Method Details

.default_dropObject



5
6
7
# File 'lib/yeshua_crm/liquid/drops/cells_drop.rb', line 5

def self.default_drop
  self.new Cell.visible.order(:name)
end

Instance Method Details

#activeObject



24
25
26
27
28
# File 'lib/yeshua_crm/liquid/drops/cells_drop.rb', line 24

def active
  @active ||= @cells.select(&:active?).map do |cell|
    CellDrop.new cell
  end
end

#allObject



18
19
20
21
22
# File 'lib/yeshua_crm/liquid/drops/cells_drop.rb', line 18

def all
  @all ||= @cells.map do |cell|
    CellDrop.new cell
  end
end

#before_method(identifier) ⇒ Object



13
14
15
16
# File 'lib/yeshua_crm/liquid/drops/cells_drop.rb', line 13

def before_method(identifier)
  cell = @cells.where(:identifier => identifier).first || Cell.new
  CellDrop.new cell
end

#each(&block) ⇒ Object



30
31
32
# File 'lib/yeshua_crm/liquid/drops/cells_drop.rb', line 30

def each(&block)
  all.each(&block)
end

#sizeObject



34
35
36
# File 'lib/yeshua_crm/liquid/drops/cells_drop.rb', line 34

def size
  @cells.size
end