Class: ChupaText::InputData
Instance Attribute Summary
Attributes inherited from Data
#attributes, #expected_screenshot_size, #need_screenshot, #path, #screenshot, #source, #uri
Instance Method Summary collapse
- #body ⇒ Object
-
#initialize(uri, options = {}) ⇒ InputData
constructor
A new instance of InputData.
- #open(&block) ⇒ Object
- #size ⇒ Object
Methods inherited from Data
#[], #[]=, #extension, #initialize_copy, #merge!, #mime_type, #mime_type=, #need_screenshot?, #text?, #text_plain?
Constructor Details
#initialize(uri, options = {}) ⇒ InputData
Returns a new instance of InputData.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/chupa-text/input-data.rb', line 23 def initialize(uri, ={}) super() self.uri = uri if @uri.class == URI::Generic @content = FileContent.new(path) else @content = download self.path = @content.path end end |
Instance Method Details
#body ⇒ Object
34 35 36 |
# File 'lib/chupa-text/input-data.rb', line 34 def body @content.body end |
#open(&block) ⇒ Object
42 43 44 |
# File 'lib/chupa-text/input-data.rb', line 42 def open(&block) @content.open(&block) end |
#size ⇒ Object
38 39 40 |
# File 'lib/chupa-text/input-data.rb', line 38 def size @content.size end |