Class: IPFS::Upload::FileNode
Overview
:nodoc:
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
Attributes inherited from Node
Instance Method Summary collapse
- #file? ⇒ Boolean
-
#initialize(name, parent = nil, content = nil) ⇒ FileNode
constructor
A new instance of FileNode.
- #inspect ⇒ Object
- #write(s) ⇒ Object
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
#content ⇒ Object (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
91 92 93 |
# File 'lib/ipfs-api/upload.rb', line 91 def file? true end |
#inspect ⇒ Object
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 |