Sha256: 8b40f91c3ca6ea89a3fcf680492c0fc0646e11c866b01d470a1164079dd1a46f

Contents?: true

Size: 370 Bytes

Versions: 5

Compression:

Stored size: 370 Bytes

Contents

module ContentState
  class Factory
    def self.derived_from(content)
      state = [New, Draft, PublicationPending,
               JustPublished, Published].detect(self) do |k|
        k.derivable_from(content)
      end.instance

      unless state
        raise "No derivable state for #{content.inspect}"
      else
        return state
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
typo-3.99.0 app/models/content_state/factory.rb
typo-3.99.2 app/models/content_state/factory.rb
typo-3.99.1 app/models/content_state/factory.rb
typo-3.99.3 app/models/content_state/factory.rb
typo-3.99.4 app/models/content_state/factory.rb