Class: TTFunk::Table::Cff::OneBasedIndex
- Inherits:
-
Object
- Object
- TTFunk::Table::Cff::OneBasedIndex
- Extended by:
- Forwardable
- Defined in:
- lib/ttfunk/table/cff/one_based_index.rb
Overview
CFF Index with indexing starting at 1.
Instance Attribute Summary collapse
-
#base_index ⇒ TTFunk::Table::Cff::Index
readonly
Underlaying Index.
Instance Method Summary collapse
-
#[](idx) ⇒ any
Get item by index.
-
#initialize(*args) ⇒ OneBasedIndex
constructor
A new instance of OneBasedIndex.
Constructor Details
#initialize(*args) ⇒ OneBasedIndex
Returns a new instance of OneBasedIndex.
25 26 27 |
# File 'lib/ttfunk/table/cff/one_based_index.rb', line 25 def initialize(*args) @base_index = Index.new(*args) end |
Instance Attribute Details
#base_index ⇒ TTFunk::Table::Cff::Index (readonly)
Underlaying Index.
21 22 23 |
# File 'lib/ttfunk/table/cff/one_based_index.rb', line 21 def base_index @base_index end |
Instance Method Details
#[](idx) ⇒ any
Get item by index.
34 35 36 37 38 39 40 41 |
# File 'lib/ttfunk/table/cff/one_based_index.rb', line 34 def [](idx) if idx.zero? raise IndexError, "index #{idx} was outside the bounds of the index" end base_index[idx - 1] end |