Class: Copyleaks::Text
- Inherits:
-
Object
- Object
- Copyleaks::Text
- Defined in:
- lib/copyleaks/models/textModeration/responses/submodules/Text.rb
Instance Attribute Summary collapse
-
#chars ⇒ Object
Returns the value of attribute chars.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(chars: TextModerationChars.new) ⇒ Text
constructor
A new instance of Text.
- #to_json(options = {}) ⇒ Object
Constructor Details
#initialize(chars: TextModerationChars.new) ⇒ Text
Returns a new instance of Text.
8 9 10 |
# File 'lib/copyleaks/models/textModeration/responses/submodules/Text.rb', line 8 def initialize(chars: TextModerationChars.new) @chars = chars end |
Instance Attribute Details
#chars ⇒ Object
Returns the value of attribute chars.
5 6 7 |
# File 'lib/copyleaks/models/textModeration/responses/submodules/Text.rb', line 5 def chars @chars end |
Class Method Details
.from_json(json_string) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/copyleaks/models/textModeration/responses/submodules/Text.rb', line 19 def self.from_json(json_string) data = JSON.parse(json_string, symbolize_names: true) new( chars: data[:chars] ? TextModerationChars.from_json(data[:chars].to_json) : nil ) end |
Instance Method Details
#to_json(options = {}) ⇒ Object
12 13 14 15 16 |
# File 'lib/copyleaks/models/textModeration/responses/submodules/Text.rb', line 12 def to_json( = {}) { chars: @chars ? JSON.parse(@chars.to_json) : nil }.to_json() end |