Module: ROC::Types::ArrayType
Class Method Summary collapse
Instance Method Summary collapse
- #<<(val) ⇒ Object
- #clear ⇒ Object
- #clobber(data) ⇒ Object
-
#delete(val) ⇒ Object
destructive methods that would otherwise be delegated – override if possible (these are in addition to a ny methods ending in ! or =, which are caught by method_missing).
- #delete_at(ind) ⇒ Object
- #delete_if ⇒ Object
- #fill(*args) ⇒ Object
- #insert(*args) ⇒ Object
- #inspect ⇒ Object
- #keep_if ⇒ Object
- #pop(*args) ⇒ Object
- #push(*args) ⇒ Object
-
#replace(val) ⇒ Object
destructive methods that we can implement here.
- #shift(*args) ⇒ Object
-
#size ⇒ Object
methods that must be implemented.
- #to_a ⇒ Object
-
#to_array ⇒ Object
can’t alias - it will to find the method in subclass.
- #to_ary ⇒ Object
- #unshift(*args) ⇒ Object
-
#values ⇒ Object
note - overriden methods should always return an array, never nil.
- #values=(data) ⇒ Object
Class Method Details
.included(base) ⇒ Object
7 8 9 |
# File 'lib/roc/types/array_type.rb', line 7 def self.included(base) base.send :delegate_methods, :on => [], :to => :values end |
Instance Method Details
#<<(val) ⇒ Object
72 73 74 |
# File 'lib/roc/types/array_type.rb', line 72 def <<(val) raise NotImplementedError end |
#clear ⇒ Object
54 55 56 |
# File 'lib/roc/types/array_type.rb', line 54 def clear self.replace([]) end |
#clobber(data) ⇒ Object
17 18 19 |
# File 'lib/roc/types/array_type.rb', line 17 def clobber(data) raise NotImplementedError, 'clobber must be overriden in any class including ArrayType' end |
#delete(val) ⇒ Object
destructive methods that would otherwise be delegated – override if possible (these are in addition to a ny methods ending in ! or =, which are caught by method_missing)
60 61 62 |
# File 'lib/roc/types/array_type.rb', line 60 def delete(val) raise NotImplementedError end |
#delete_at(ind) ⇒ Object
64 65 66 |
# File 'lib/roc/types/array_type.rb', line 64 def delete_at(ind) raise NotImplementedError end |
#delete_if ⇒ Object
68 69 70 |
# File 'lib/roc/types/array_type.rb', line 68 def delete_if raise NotImplementedError end |
#fill(*args) ⇒ Object
76 77 78 |
# File 'lib/roc/types/array_type.rb', line 76 def fill(*args) raise NotImplementedError end |
#insert(*args) ⇒ Object
80 81 82 |
# File 'lib/roc/types/array_type.rb', line 80 def insert(*args) raise NotImplementedError end |
#inspect ⇒ Object
43 44 45 |
# File 'lib/roc/types/array_type.rb', line 43 def inspect "<#{self.class} @storage=#{self.storage.inspect} @key=#{self.key.inspect} @size=#{self.size}>" end |
#keep_if ⇒ Object
84 85 86 |
# File 'lib/roc/types/array_type.rb', line 84 def keep_if raise NotImplementedError end |
#pop(*args) ⇒ Object
92 93 94 |
# File 'lib/roc/types/array_type.rb', line 92 def pop(*args) raise NotImplementedError end |
#push(*args) ⇒ Object
88 89 90 |
# File 'lib/roc/types/array_type.rb', line 88 def push(*args) raise NotImplementedError end |
#replace(val) ⇒ Object
destructive methods that we can implement here
49 50 51 52 |
# File 'lib/roc/types/array_type.rb', line 49 def replace(val) self.clobber(val) self end |
#shift(*args) ⇒ Object
96 97 98 |
# File 'lib/roc/types/array_type.rb', line 96 def shift(*args) raise NotImplementedError end |
#size ⇒ Object
methods that must be implemented
13 14 15 |
# File 'lib/roc/types/array_type.rb', line 13 def size raise NotImplementedError, 'size must be overriden in any class including ArrayType' end |
#to_a ⇒ Object
35 36 37 |
# File 'lib/roc/types/array_type.rb', line 35 def to_a self.values end |
#to_array ⇒ Object
can’t alias - it will to find the method in subclass
29 30 31 |
# File 'lib/roc/types/array_type.rb', line 29 def to_array self.values end |
#to_ary ⇒ Object
32 33 34 |
# File 'lib/roc/types/array_type.rb', line 32 def to_ary self.values end |
#unshift(*args) ⇒ Object
100 101 102 |
# File 'lib/roc/types/array_type.rb', line 100 def unshift(*args) raise NotImplementedError end |
#values ⇒ Object
note - overriden methods should always return an array, never nil
22 23 24 |
# File 'lib/roc/types/array_type.rb', line 22 def values raise NotImplementedError, 'values must be overriden in any class including ArrayType' end |
#values=(data) ⇒ Object
39 40 41 |
# File 'lib/roc/types/array_type.rb', line 39 def values=(data) self.clobber(data) end |