Sha256: 507026d94aa3fc451caaa18364805d2c45fb02f3b89d474b854ee7dddd426803

Contents?: true

Size: 997 Bytes

Versions: 21

Compression:

Stored size: 997 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.true?
      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.true?
      return other
    else
      return self
    end
  end

  def try(*a, &b)
    if a.empty? && block_given?
      yield self
    else
      __send__(*a, &b)
    end
  end

  def deep_cur
    self.cur
  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

21 entries across 21 versions & 1 rubygems

Version Path
volt-0.7.23 lib/volt/extra_core/object.rb
volt-0.7.22 lib/volt/extra_core/object.rb
volt-0.7.21 lib/volt/extra_core/object.rb
volt-0.7.20 lib/volt/extra_core/object.rb
volt-0.7.19 lib/volt/extra_core/object.rb
volt-0.7.18 lib/volt/extra_core/object.rb
volt-0.7.17 lib/volt/extra_core/object.rb
volt-0.7.16 lib/volt/extra_core/object.rb
volt-0.7.15 lib/volt/extra_core/object.rb
volt-0.7.14 lib/volt/extra_core/object.rb
volt-0.7.13 lib/volt/extra_core/object.rb
volt-0.7.12 lib/volt/extra_core/object.rb
volt-0.7.10 lib/volt/extra_core/object.rb
volt-0.7.9 lib/volt/extra_core/object.rb
volt-0.7.8 lib/volt/extra_core/object.rb
volt-0.7.7 lib/volt/extra_core/object.rb
volt-0.7.6 lib/volt/extra_core/object.rb
volt-0.7.5 lib/volt/extra_core/object.rb
volt-0.7.4 lib/volt/extra_core/object.rb
volt-0.7.3 lib/volt/extra_core/object.rb