Class: TSJSON::Merge
Direct Known Subclasses
Instance Attribute Summary collapse
-
#is_normal ⇒ Object
Returns the value of attribute is_normal.
-
#types ⇒ Object
readonly
Returns the value of attribute types.
Instance Method Summary collapse
-
#initialize(types = [], is_normal = false) ⇒ Merge
constructor
A new instance of Merge.
Methods inherited from Base
#compile, #index, #property, #valid?
Constructor Details
#initialize(types = [], is_normal = false) ⇒ Merge
Returns a new instance of Merge.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/types/merge.rb', line 6 def initialize(types = [], is_normal = false) super() types.each do |t| unless t.is_a?(ObjectType) || t.is_a?(Union) || t.is_a?(Intersection) raise "#{ self.class.name } may contain only ObjectType, Union or Intersection types" end end @types = types @is_normal = types.length == 0 || is_normal end |
Instance Attribute Details
#is_normal ⇒ Object
Returns the value of attribute is_normal.
4 5 6 |
# File 'lib/types/merge.rb', line 4 def is_normal @is_normal end |
#types ⇒ Object (readonly)
Returns the value of attribute types.
3 4 5 |
# File 'lib/types/merge.rb', line 3 def types @types end |