Results for: "strip"

Processes the topmost available {RequirementState} on the stack @return [void]

Writes data onto the IO, raising a FileOverflow exception if the number of bytes will be more than limit

Writes data onto the IO

No documentation available

Re-composes a prime factorization and returns the product.

See Prime#int_from_prime_division for more details.

No documentation available

Passes each grapheme cluster in str to the given block, or returns an enumerator if no block is given. Unlike String#each_char, this enumerates by grapheme clusters defined by Unicode Standard Annex #29 unicode.org/reports/tr29/

"a\u0300".each_char.to_a.size #=> 2
"a\u0300".each_grapheme_cluster.to_a.size #=> 1

Returns a list of the public instance methods defined in mod. If the optional parameter is false, the methods of any ancestors are not included.

Returns a list of the protected instance methods defined in mod. If the optional parameter is false, the methods of any ancestors are not included.

Returns the Ruby source filename and line number containing the definition of the constant specified. If the named constant is not found, nil is returned. If the constant is found, but its source location can not be extracted (constant is defined in C code), empty array is returned.

inherit specifies whether to lookup in mod.ancestors (true by default).

# test.rb:
class A         # line 1
  C1 = 1
  C2 = 2
end

module M        # line 6
  C3 = 3
end

class B < A     # line 10
  include M
  C4 = 4
end

class A # continuation of A definition
  C2 = 8 # constant redefinition; warned yet allowed
end

p B.const_source_location('C4')           # => ["test.rb", 12]
p B.const_source_location('C3')           # => ["test.rb", 7]
p B.const_source_location('C1')           # => ["test.rb", 2]

p B.const_source_location('C3', false)    # => nil  -- don't lookup in ancestors

p A.const_source_location('C2')           # => ["test.rb", 16] -- actual (last) definition place

p Object.const_source_location('B')       # => ["test.rb", 10] -- top-level constant could be looked through Object
p Object.const_source_location('A')       # => ["test.rb", 1] -- class reopening is NOT considered new definition

p B.const_source_location('A')            # => ["test.rb", 1]  -- because Object is in ancestors
p M.const_source_location('A')            # => ["test.rb", 1]  -- Object is not ancestor, but additionally checked for modules

p Object.const_source_location('A::C1')   # => ["test.rb", 2]  -- nesting is supported
p Object.const_source_location('String')  # => []  -- constant is defined in C code

Removes the named class variable from the receiver, returning that variable’s value.

class Example
  @@var = 99
  puts remove_class_variable(:@@var)
  p(defined? @@var)
end

produces:

99
nil

Returns the value of the given class variable (or throws a NameError exception). The @@ part of the variable name should be included for regular class variables. String arguments are converted to symbols.

class Fred
  @@foo = 99
end
Fred.class_variable_get(:@@foo)     #=> 99

Sets the class variable named by symbol to the given object. If the class variable name is passed as a string, that string is converted to a symbol.

class Fred
  @@foo = 99
  def foo
    @@foo
  end
end
Fred.class_variable_set(:@@foo, 101)     #=> 101
Fred.new.foo                             #=> 101

Returns true if the given class variable is defined in obj. String arguments are converted to symbols.

class Fred
  @@foo = 99
end
Fred.class_variable_defined?(:@@foo)    #=> true
Fred.class_variable_defined?(:@@bar)    #=> false

Similar to instance_method, searches public method only.

Returns true if the named private method is defined by mod. If inherit is set, the lookup will also search mod’s ancestors. String arguments are converted to symbols.

module A
  def method1()  end
end
class B
  private
  def method2()  end
end
class C < B
  include A
  def method3()  end
end

A.method_defined? :method1                   #=> true
C.private_method_defined? "method1"          #=> false
C.private_method_defined? "method2"          #=> true
C.private_method_defined? "method2", true    #=> true
C.private_method_defined? "method2", false   #=> false
C.method_defined? "method2"                  #=> false

Makes existing class methods private. Often used to hide the default constructor new.

String arguments are converted to symbols. An Array of Symbols and/or Strings are also accepted.

class SimpleSingleton  # Not thread safe
  private_class_method :new
  def SimpleSingleton.create(*args, &block)
    @me = new(*args, &block) if ! @me
    @me
  end
end
No documentation available
No documentation available

for compatibility

No documentation available

Returns a string representation of lex_state.

Returns true for IPv6 unique local address (fc00::/7, RFC4193). It returns false otherwise.

Returns true for IPv6 multicast node-local scope address. It returns false otherwise.

Returns true for IPv6 multicast link-local scope address. It returns false otherwise.

Search took: 5ms  ·  Total Results: 1474