Class: Vedeu::Models::Page Private

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Enumerable
Defined in:
lib/vedeu/models/page.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A Page represents an array of Vedeu::Models::Row objects.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rows = []) ⇒ Vedeu::Models::Page

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Vedeu::Models::Page.

Parameters:



32
33
34
# File 'lib/vedeu/models/page.rb', line 32

def initialize(rows = [])
  @rows = rows || []
end

Instance Attribute Details

#rowsArray<NilClass|Vedeu::Models::Row> (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:



17
18
19
# File 'lib/vedeu/models/page.rb', line 17

def rows
  @rows
end

Instance Method Details

#cell(row_index = nil, cell_index = nil) ⇒ NilClass|void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • row_index (Fixnum) (defaults to: nil)
  • cell_index (Fixnum) (defaults to: nil)

Returns:

  • (NilClass|void)


44
45
46
47
48
49
# File 'lib/vedeu/models/page.rb', line 44

def cell(row_index = nil, cell_index = nil)
  return nil if row_index.nil? || cell_index.nil?
  return nil unless row(row_index)

  row(row_index)[cell_index]
end

#contentArray<void>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Array<void>)


37
38
39
# File 'lib/vedeu/models/page.rb', line 37

def content
  rows.flat_map(&:content)
end

#each(&block) ⇒ Enumerator

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Provides iteration over the collection.

Parameters:

  • block (Proc)

Returns:

  • (Enumerator)


55
56
57
# File 'lib/vedeu/models/page.rb', line 55

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

#empty?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:



60
61
62
# File 'lib/vedeu/models/page.rb', line 60

def empty?
  rows.empty?
end

#eql?(other) ⇒ Boolean Also known as: ==

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

An object is equal when its values are the same.

Parameters:

Returns:



68
69
70
# File 'lib/vedeu/models/page.rb', line 68

def eql?(other)
  self.class.equal?(other.class) && rows == other.rows
end

#row(index = nil) ⇒ NilClass|Vedeu::Models::Row

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • index (Fixnum) (defaults to: nil)

Returns:



75
76
77
78
79
# File 'lib/vedeu/models/page.rb', line 75

def row(index = nil)
  return nil if index.nil?

  rows[index]
end

#sizeFixnum

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Fixnum)


82
83
84
# File 'lib/vedeu/models/page.rb', line 82

def size
  rows.size
end