Sha256: 5d019dee6e82ae025c709c8d6d337897a810d14985fb27152d9fdf2437c30cf0
Contents?: true
Size: 542 Bytes
Versions: 2
Compression:
Stored size: 542 Bytes
Contents
# 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
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
teton-0.0.3 | lib/teton/key_pointer.rb |
teton-0.0.2 | lib/teton/key_pointer.rb |