lib/nanoc/base/source_data/item.rb in nanoc-3.7.4 vs lib/nanoc/base/source_data/item.rb in nanoc-3.7.5
- old
+ new
@@ -1,14 +1,12 @@
# encoding: utf-8
module Nanoc
-
# Represents a compileable item in a site. It has content and attributes, as
# well as an identifier (which starts and ends with a slash). It can also
# store the modification time to speed up compilation.
class Item
-
extend Nanoc::Memoization
# @return [Hash] This item's attributes
attr_accessor :attributes
@@ -68,11 +66,11 @@
# @option params [Symbol, nil] :binary (true) Whether or not this item is
# binary
def initialize(raw_content_or_raw_filename, attributes, identifier, params = nil)
# Parse params
params ||= {}
- params = { :mtime => params } if params.is_a?(Time)
+ params = { mtime: params } if params.is_a?(Time)
params[:binary] = false unless params.key?(:binary)
if raw_content_or_raw_filename.nil?
raise "attempted to create an item with no content/filename (identifier #{identifier})"
end
@@ -89,11 +87,11 @@
# Get rest of params
@attributes = attributes.symbolize_keys_recursively
@identifier = identifier.cleaned_identifier.freeze
# Set mtime
- @attributes.merge!(:mtime => params[:mtime]) if params[:mtime]
+ @attributes.merge!(mtime: params[:mtime]) if params[:mtime]
@parent = nil
@children = []
@reps = []
@@ -170,11 +168,11 @@
def [](key)
Nanoc::NotificationCenter.post(:visit_started, self)
Nanoc::NotificationCenter.post(:visit_ended, self)
# Get captured content (hax)
- # TODO [in nanoc 4.0] remove me
+ # TODO: [in nanoc 4.0] remove me
if key.to_s =~ /^content_for_(.*)$/
@@_content_for_warning_issued ||= false
@@_capturing_helper_included ||= false
# Warn
@@ -293,9 +291,7 @@
# @deprecated Access the modification time using `item[:mtime]` instead.
def mtime
self[:mtime]
end
-
end
-
end