Module: TwitterTweetBot::Cache::EntityExt::Base

Extended by:
ActiveSupport::Concern
Included in:
Authorization, Token
Defined in:
lib/twitter_tweet_bot/cache/entity_ext/base.rb

Instance Method Summary collapse

Instance Method Details

#to_cacheObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/twitter_tweet_bot/cache/entity_ext/base.rb', line 17

def to_cache
  cache_fields.each_with_object({}) do |cache_field, hash|
    next hash unless respond_to?(cache_field)

    value = send(cache_field)
    next hash if value.nil?

    hash[cache_field] = value
  end
end