Sha256: c877c83ec6fd89dc09c31786092f7ec8815381bc10e30610851fe716c4eb1ec7

Contents?: true

Size: 864 Bytes

Versions: 8

Compression:

Stored size: 864 Bytes

Contents

class Object
  # Setup a default pretty_inspect
  # alias_method :pretty_inspect, :inspect

  def instance_values
    Hash[instance_variables.map { |name| [name[1..-1], instance_variable_get(name)] }]
  end

  # Provides the same functionality as ||, but since ReactiveValue's only
  # work with method calls, we provide .or as a convience.
  def or(other)
    if self && !self.nil?
      return self
    else
      return other
    end
  end

  # Provides the same functionality as &&, but since ReactiveValue's only
  # work with method calls, we provide .and as a convience
  def and(other)
    if self && !self.nil?
      return other
    else
      return self
    end
  end

  def html_inspect
    inspect.gsub('<', '&lt;').gsub('>', '&gt;')
  end

  # TODO: Need a real implementation of this
  def deep_clone
    Marshal.load(Marshal.dump(self))
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
volt-0.8.7 lib/volt/extra_core/object.rb
volt-0.8.6 lib/volt/extra_core/object.rb
volt-0.8.5 lib/volt/extra_core/object.rb
volt-0.8.4 lib/volt/extra_core/object.rb
volt-0.8.3 lib/volt/extra_core/object.rb
volt-0.8.2 lib/volt/extra_core/object.rb
volt-0.8.1 lib/volt/extra_core/object.rb
volt-0.8.0 lib/volt/extra_core/object.rb