class Representable::ParseStrategy

Parse strategies are just a combination of representable's options. They save you from memoizing the necessary parameters.

Feel free to contribute your strategy if you think it's worth sharing!

Public Class Methods

apply!(options) click to toggle source
# File lib/representable/parse_strategies.rb, line 7
def self.apply!(options)
  return unless strategy = options[:parse_strategy]

  strategy = :proc if strategy.is_a?(::Proc)

  parse_strategies[strategy].apply!(name, options)
end
parse_strategies() click to toggle source
# File lib/representable/parse_strategies.rb, line 15
def self.parse_strategies
  {
    :sync                 => Sync,
    :find_or_instantiate  => FindOrInstantiate,
    :proc                 => Proc
  }
end