Class: AnyValue::ArrayOf
Instance Method Summary collapse
- #==(o) ⇒ Object
-
#initialize(element) ⇒ ArrayOf
constructor
A new instance of ArrayOf.
- #inspect ⇒ Object
Methods inherited from Anything
Constructor Details
#initialize(element) ⇒ ArrayOf
Returns a new instance of ArrayOf.
186 187 188 189 190 191 192 193 |
# File 'lib/any_value.rb', line 186 def initialize(element) unless element.is_a?(Anything) raise ArgumentError, "invalid argument: #{element.inspect}" end super @element = element end |
Instance Method Details
#==(o) ⇒ Object
195 196 197 |
# File 'lib/any_value.rb', line 195 def ==(o) o.all? { |x| x == @element } end |
#inspect ⇒ Object
199 200 201 |
# File 'lib/any_value.rb', line 199 def inspect "#<ArrayOf #{@element.inspect}>" end |