Module: When::CalendarTypes::CalendarNote::LabelAccess

Defined in:
lib/when_exe/calendartypes.rb

Overview

暦注要素への名前アクセス機能提供

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#_poolObject (readonly)

Returns the value of attribute _pool.



1114
1115
1116
# File 'lib/when_exe/calendartypes.rb', line 1114

def _pool
  @_pool
end

Instance Method Details

#[](key) ⇒ Object

暦注要素への名前(label)によるアクセス

Parameters:

  • key (Numeric)

    配列インデックスと見なしてアクセス

  • key (String)

    名前(label)と見なしてアクセス

Returns:

  • (Object)

    暦注要素



1124
1125
1126
1127
1128
# File 'lib/when_exe/calendartypes.rb', line 1124

def [](key)
  return super if key.kind_of?(Numeric)
  @_pool ||= Hash[*(inject([]) {|pair, v| pair << v.label.to_s << v})]
  @_pool[key]
end