Class: Nanoc::DataSources::Filesystem::ProtoDocument Private

Inherits:
Object
  • Object
show all
Defined in:
lib/nanoc/data_sources/filesystem.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(is_binary:, attributes:, content: nil, filename: nil, content_checksum_data: nil, attributes_checksum_data: nil) ⇒ ProtoDocument

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ProtoDocument.



121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/nanoc/data_sources/filesystem.rb', line 121

def initialize(is_binary:, attributes:, content: nil, filename: nil, content_checksum_data: nil, attributes_checksum_data: nil)
  if content.nil? && filename.nil?
    raise ArgumentError, '#initialize needs at least content or filename'
  end

  @is_binary = is_binary
  @content = content
  @filename = filename
  @attributes = attributes
  @content_checksum_data = content_checksum_data
  @attributes_checksum_data = attributes_checksum_data
end

Instance Attribute Details

#attributesObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



115
116
117
# File 'lib/nanoc/data_sources/filesystem.rb', line 115

def attributes
  @attributes
end

#attributes_checksum_dataObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



117
118
119
# File 'lib/nanoc/data_sources/filesystem.rb', line 117

def attributes_checksum_data
  @attributes_checksum_data
end

#content_checksum_dataObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



116
117
118
# File 'lib/nanoc/data_sources/filesystem.rb', line 116

def content_checksum_data
  @content_checksum_data
end

#is_binaryObject (readonly) Also known as: binary?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



118
119
120
# File 'lib/nanoc/data_sources/filesystem.rb', line 118

def is_binary
  @is_binary
end

Instance Method Details

#contentObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



134
135
136
137
138
139
140
# File 'lib/nanoc/data_sources/filesystem.rb', line 134

def content
  if binary?
    raise ArgumentError, 'cannot fetch content of binary item'
  else
    @content
  end
end

#filenameObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



142
143
144
145
146
147
148
# File 'lib/nanoc/data_sources/filesystem.rb', line 142

def filename
  if binary?
    @filename
  else
    raise ArgumentError, 'cannot fetch filename of non-binary item'
  end
end