class Police::Labels::UnsafeStream
Adds a label to any data read from a IO stream.
Public Class Methods
autoflow?()
click to toggle source
@see Police::DataFlow::Label#autoflow?
# File lib/police/labels/unsafe_stream.rb, line 14 def self.autoflow? false end
new(unsafe_label)
click to toggle source
@param [Police::DataFlow::Label] unsafe_label the label that will be added
to the stream's data
# File lib/police/labels/unsafe_stream.rb, line 9 def initialize(unsafe_label) @label = unsafe_label end
return_hook(method_name)
click to toggle source
@see Police::DataFlow::Label#return_hook
# File lib/police/labels/unsafe_stream.rb, line 24 def self.return_hook(method_name) case method_name when :read :read else nil end end
yield_args_hook(method_name)
click to toggle source
@see Police::DataFlow::Label#yield_args_hook
# File lib/police/labels/unsafe_stream.rb, line 34 def self.yield_args_hook(method_name) nil end
Public Instance Methods
accepts?(data)
click to toggle source
@see Police::DataFlow::Label#accepts?
# File lib/police/labels/unsafe_stream.rb, line 19 def accepts?(data) data.kind_of?(IO) || data.kind_of?(StringIO) end
read(return_value, receiver, *args)
click to toggle source
Adds a label to the read’s return value. @see IO#read
# File lib/police/labels/unsafe_stream.rb, line 40 def read(return_value, receiver, *args) Police::DataFlow.label return_value, @label end