Sha256: 7d9b5238be583615f41a354ac56218928a0305818cec3059f615e26790310a89

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

module Assets

  # Abstract base class for rules that generate assets
  class Rule 
    include Adamantium, AbstractType

    # Return asset
    #
    # @return [Asset]
    #
    # @api private
    #
    def asset
      Evaluator.new(self).asset
    end

    # Return body
    #
    # @return [String]
    #
    # @api private
    #
    abstract_method :body

    # Return mime 
    #
    # @return [Mime]
    #
    # @api private
    #
    abstract_method :mime

    # Return updated at
    #
    # @return [Time]
    #
    # @api private
    #
    abstract_method :updated_at

    # Return renamed asset
    #
    # @param [String] name
    # 
    # @return [Rule::Rename]
    #
    # @api private
    #
    def rename(name)
      Rename.new(name, self)
    end

    # Test if asset is fresh at specific time
    #
    # @param [Time] time
    #
    # @return [true]
    #   if asset is fresh at time
    #
    # @return [false]
    #
    # @api private
    #
    def fresh_at?(time)
      time >= updated_at
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mbj-assets-0.0.5 lib/assets/rule.rb
mbj-assets-0.0.4 lib/assets/rule.rb
mbj-assets-0.0.3 lib/assets/rule.rb