Class: Copyleaks::SubmissionCrossLanguages
- Inherits:
-
Object
- Object
- Copyleaks::SubmissionCrossLanguages
- Defined in:
- lib/copyleaks/models/submissions/properties/cross_languages.rb
Instance Method Summary collapse
- #as_json(*_args) ⇒ Object
-
#initialize(languages = nil) ⇒ SubmissionCrossLanguages
constructor
A new instance of SubmissionCrossLanguages.
- #to_json(*options) ⇒ Object
Constructor Details
#initialize(languages = nil) ⇒ SubmissionCrossLanguages
Returns a new instance of SubmissionCrossLanguages.
27 28 29 30 31 32 |
# File 'lib/copyleaks/models/submissions/properties/cross_languages.rb', line 27 def initialize(languages = nil) if !languages.nil? && !(languages.is_a?(Array) && languages.all? { |element| element.is_a?(SubmissionLanguage) }) raise 'Copyleaks::SubmissionCrossLanguages - languages - languages must be of type SubmissionLanguage[]' end @languages = languages end |
Instance Method Details
#as_json(*_args) ⇒ Object
34 35 36 37 38 |
# File 'lib/copyleaks/models/submissions/properties/cross_languages.rb', line 34 def as_json(*_args) { languages: @languages, }.select { |_k, v| !v.nil? } end |
#to_json(*options) ⇒ Object
40 41 42 |
# File 'lib/copyleaks/models/submissions/properties/cross_languages.rb', line 40 def to_json(*) as_json(*).to_json(*) end |