Class: IPFS::Upload::FileNode

Inherits:
Node
  • Object
show all
Defined in:
lib/ipfs-api/upload.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Attributes inherited from Node

#bytes, #hash, #name, #parent

Instance Method Summary collapse

Methods inherited from Node

#finished?, #folder?, #path, #to_s

Constructor Details

#initialize(name, parent = nil, content = nil) ⇒ FileNode

Returns a new instance of FileNode.



77
78
79
80
81
82
83
84
85
# File 'lib/ipfs-api/upload.rb', line 77

def initialize name, parent = nil, content = nil
  super(name, parent)
  if block_given?
    @content = ''
    yield self
  else
    @content = content.to_s
  end
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



75
76
77
# File 'lib/ipfs-api/upload.rb', line 75

def content
  @content
end

Instance Method Details

#file?Boolean

Returns:

  • (Boolean)


91
92
93
# File 'lib/ipfs-api/upload.rb', line 91

def file?
  true
end

#inspectObject



95
96
97
# File 'lib/ipfs-api/upload.rb', line 95

def inspect
  "file:#{super}"
end

#write(s) ⇒ Object



87
88
89
# File 'lib/ipfs-api/upload.rb', line 87

def write s
  @content << s
end