class Brauser::Value

A defined entity, which supports comparison against a single or multiple values.

@attribute [r] value

@return [Object] The wrapped value.

Attributes

value[R]

Public Class Methods

new(value) click to toggle source

Creates a new value

@param value [Object] The wrapped value.

# File lib/brauser/value.rb, line 18
def initialize(value)
  @value = value
end

Public Instance Methods

==(other) click to toggle source

Check if an object is equal to another object or if it is contained in a list of objects.

@param other [Array|Object] The other object to match. @return [Boolean] `true` if the current object is either equal or contained in the other object, `false` otherwise.

# File lib/brauser/value.rb, line 26
def ==(other)
  other.is_a?(Array) ? other.include?(@value) : (@value == other)
end
method_missing(method, *args, &block) click to toggle source

Delegates all the other values to the wrapped value.

@param method [Symbol] The method to call. @param args [Array] The arguments to pass to the method. @param block [Proc] The block to pass to the method.

# File lib/brauser/value.rb, line 35
def method_missing(method, *args, &block)
  @value.send(method, *args, &block)
end