-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
53d46db
commit 32d4cc6
Showing
6 changed files
with
96 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,6 @@ RSpec/ExampleLength: | |
|
||
Metrics/ClassLength: | ||
Max: 150 | ||
|
||
Layout/LineLength: | ||
Max: 125 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
|
||
#### 0.0.1 - TBD | ||
#### 0.0.2 - Monday, Sept. 5th, 2022 | ||
|
||
* Initial proof-of-concept release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# frozen_string_literal: true | ||
|
||
module Teton | ||
# Points to a section within a key's parts. A section can either be a resource or an entry. | ||
class KeyPointer | ||
attr_reader :key, :index | ||
|
||
def initialize(key, index) | ||
@key = key | ||
@index = index.to_i | ||
|
||
freeze | ||
end | ||
|
||
def value | ||
key.parts[index] | ||
end | ||
|
||
def not_last? | ||
!last? | ||
end | ||
|
||
def last? | ||
index == key.parts.length - 1 | ||
end | ||
|
||
def entry? | ||
index.odd? | ||
end | ||
|
||
def resource? | ||
index.even? || index.zero? | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module Teton | ||
VERSION = '0.0.1' | ||
VERSION = '0.0.2' | ||
end |