Module: RubyLokaliseApi::Concerns::HashAccessible
- Included in:
- Generics, Resources::Base
- Defined in:
- lib/ruby_lokalise_api/concerns/hash_accessible.rb
Overview
Adds the ‘[]` method for invariant access
Instance Method Summary collapse
Instance Method Details
#[](raw_key_attr) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/ruby_lokalise_api/concerns/hash_accessible.rb', line 7 def [](raw_key_attr) key_attr = :"@#{raw_key_attr}" return nil unless instance_variables.include?(key_attr) && respond_to?(raw_key_attr.to_sym) instance_variable_get(key_attr) end |