Sha256: 662a85c9fe73c4aa3fa1377a1d07b1f68c27932fe4f191d8b4a0d4f6b0cda731

Contents?: true

Size: 985 Bytes

Versions: 2

Compression:

Stored size: 985 Bytes

Contents

class Symbol {
  def eval {
    binding = Binding setup(Rubinius VariableScope of_sender(),
                            Rubinius CompiledMethod of_sender(),
                            Rubinius StaticScope of_sender())
    Fancy eval: to_s binding: binding
  }

  def inspect {
    "'" ++ to_s
  }

  def defined? {
    """
    @return @true, if @self is defined as a constant in senders scope, @false otherwise.

    Indicates if a Symbol is defined as a constant in the senders scope.
    """

    binding = Binding setup(Rubinius VariableScope of_sender(),
                            Rubinius CompiledMethod of_sender(),
                            Rubinius StaticScope of_sender())

    binding send('self) class const_defined?(self)
  }

  def message_name {
    symbol = self to_s
    val = symbol include?(":")
    match val {
      case true -> symbol to_sym
      case false -> ":" <<(symbol) to_sym
    }
  }

  def to_fancy_message {
    to_s to_fancy_message to_sym
  }
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fancy-0.9.0 lib/rbx/symbol.fy
fancy-0.8.0 lib/rbx/symbol.fy