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.
Source Code
lib/ttfunk/table/cff/one_based_index.rb, line 25
25 | def initialize(*args) |
26 | @base_index = Index.new(*args) |
27 | end
|
Instance Attribute Details
#base_index ⇒ TTFunk::Table::Cff::Index (readonly)
Underlaying Index.
Source Code
lib/ttfunk/table/cff/one_based_index.rb, line 21
21 | def base_index |
22 | @base_index
|
23 | end
|
Instance Method Details
#[](idx) ⇒ any
Get item by index.
Source Code
lib/ttfunk/table/cff/one_based_index.rb, line 34
34 | def [](idx) |
35 | if idx.zero? |
36 | raise IndexError, |
37 | "index #{idx} was outside the bounds of the index" |
38 | end
|
39 | |
40 | base_index[idx - 1] |
41 | end
|