Class: ChupaText::TextData
Instance Attribute Summary
Attributes inherited from Data
#attributes, #body, #expected_screenshot_size, #limit_as, #limit_cpu, #max_body_size, #need_screenshot, #path, #screenshot, #size, #source, #timeout, #uri
Instance Method Summary collapse
-
#initialize(text, options = {}) ⇒ TextData
constructor
A new instance of TextData.
Methods inherited from Data
#[], #[]=, #extension, #initialize_copy, #merge!, #mime_type, #mime_type=, #need_screenshot?, #open, #peek_body, #release, #text?, #text_plain?, #to_utf8_body_data
Constructor Details
#initialize(text, options = {}) ⇒ TextData
Returns a new instance of TextData.
19 20 21 22 23 24 25 |
# File 'lib/chupa-text/text-data.rb', line 19 def initialize(text, ={}) super() self.uri = Pathname(path.to_s.gsub(/\.[a-z\d]+\z/i, ".txt")) self.mime_type = "text/plain" self.body = text self.size = text.bytesize end |