Method: Stic::Readable#initialize

Defined in:
lib/stic/readable.rb

#initialize(opts = {}) ⇒ Object

Initialize new file blob object.

Parameters:

  • opts (Hash) (defaults to: {})

    Initialization options.

Options Hash (opts):

  • :source (#to_s)

    Required Full source path. See #source.

  • :path (#to_s)

    Output path. Will use source path if not given. See #path.

  • :name (String)

    Optional blob file name. See #name.



45
46
47
48
49
50
51
52
53
54
# File 'lib/stic/readable.rb', line 45

def initialize(opts = {})
  super

  source = opts.delete(:source) { raise ::ArgumentError.new 'Argument `:source` required.' }
  path   = opts.delete(:path)   { source }

  @source = Path(source).expand
  @path   = Path(path).as_relative
  @name   = opts.delete(:name) || @path.name
end