Module: AndFeathers::Tarball::ContainsFiles

Included in:
AndFeathers::Tarball, Directory
Defined in:
lib/and_feathers/tarball/contains_files.rb

Overview

A module which gives instances of a class the file DSL method

Constant Summary collapse

NO_CONTENT =

The default file content block, which returns an empty string

Proc.new { "" }

Instance Method Summary collapse

Instance Method Details

#file(name, mode = 33188, &content) ⇒ Object

Add a File named name to this entity’s list of children

Parameters:

  • name (String)

    the file name

  • mode (Fixnum) (defaults to: 33188)

    the file mode

Yield Returns:

  • (String)

    the file contents



20
21
22
23
24
# File 'lib/and_feathers/tarball/contains_files.rb', line 20

def file(name, mode = 33188, &content)
  content ||= NO_CONTENT

  @children.push(File.new(name, mode, content, self))
end