Results for: "String#[]"

Write value to a registry value named name.

If wtype is specified, the value type is it. Otherwise, the value type is depend on class of value: :Integer

REG_DWORD

:String

REG_SZ

:Array

REG_MULTI_SZ

Set the element of WIN32OLE::Variant object(OLE array) to val. This method is available only when the variant type of WIN32OLE::Variant object is VT_ARRAY.

REMARK:

The all indices should be 0 or natural number and
lower than or equal to max indices.
(This point is different with Ruby Array indices.)

obj = WIN32OLE::Variant.new([[1,2,3],[4,5,6]])
obj[0,0] = 7
obj[1,0] = 8
p obj.value # => [[7,2,3], [8,5,6]]
obj[2,0] = 9 # => WIN32OLE::RuntimeError
obj[0, -1] = 9 # => WIN32OLE::RuntimeError

Set the session data for key key.

No documentation available

Set configuration option key to value.

Set key to value in database.

value will be converted to YAML before storage.

See store for more information.

Associates the given value with the given key.

If the given key exists, replaces its value with the given value; the ordering is not affected.

Associates the given value with the given key

The reference to key is weak, so when there is no other reference to key it may be garbage collected.

If the given key exists, replaces its value with the given value; the ordering is not affected

Sets the value for the case-insensitive key to val, overwriting the previous value if the field exists; see Fields:

req = Net::HTTP::Get.new(uri)
req['Accept'] # => "*/*"
req['Accept'] = 'text/html'
req['Accept'] # => "text/html"

Note that some field values may be set via convenience methods; see Setters.

Adds a post-installs hook that will be passed a Gem::DependencyInstaller and a list of installed specifications when Gem::DependencyInstaller#install is complete

Returns the list of Modules nested at the point of call.

module M1
  module M2
    $a = Module.nesting
  end
end
$a           #=> [M1::M2, M1]
$a[0].name   #=> "M1::M2"

Returns the binding associated with prc.

def fred(param)
  proc {}
end

b = fred(99)
eval("param", b.binding)   #=> 99

Returns the generated binding object from the event.

Note that for :c_call and :c_return events, the method returns nil, since C methods themselves do not have bindings.

Returns a Binding object, describing the variable and method bindings at the point of call. This object can be used when calling Binding#eval to execute the evaluated command in this environment, or extracting its local variables.

class User
  def initialize(name, position)
    @name = name
    @position = position
  end

  def get_binding
    binding
  end
end

user = User.new('Joan', 'manager')
template = '{name: @name, position: @position}'

# evaluate template in context of the object
eval(template, user.get_binding)
#=> {:name=>"Joan", :position=>"manager"}

Binding#local_variable_get can be used to access the variables whose names are reserved Ruby keywords:

# This is valid parameter declaration, but `if` parameter can't
# be accessed by name, because it is a reserved word.
def validate(field, validation, if: nil)
  condition = binding.local_variable_get('if')
  return unless condition

  # ...Some implementation ...
end

validate(:name, :empty?, if: false) # skips validation
validate(:name, :empty?, if: true) # performs validation

Returns help string of OLE method. If the help string is not found, then the method returns nil.

tobj = WIN32OLE::Type.new('Microsoft Internet Controls', 'IWebBrowser')
method = WIN32OLE::Method.new(tobj, 'Navigate')
puts method.helpstring # => Navigates to a URL or file.

Returns help string.

tobj = WIN32OLE::Type.new('Microsoft Internet Controls', 'IWebBrowser')
puts tobj.helpstring # => Web Browser interface

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

class Fred
  def initialize(p1, p2)
    @a, @b = p1, p2
  end
end
fred = Fred.new('cat', 99)
fred.instance_variable_defined?(:@a)    #=> true
fred.instance_variable_defined?("@b")   #=> true
fred.instance_variable_defined?("@c")   #=> false

Returns whether the [position] is at the beginning of a line; that is, at the beginning of the [stored string] or immediately after a newline:

scanner = StringScanner.new(MULTILINE_TEXT)
scanner.string
# => "Go placidly amid the noise and haste,\nand remember what peace there may be in silence.\n"
scanner.pos                # => 0
scanner.beginning_of_line? # => true

scanner.scan_until(/,/)    # => "Go placidly amid the noise and haste,"
scanner.beginning_of_line? # => false

scanner.scan(/\n/)         # => "\n"
scanner.beginning_of_line? # => true

scanner.terminate
scanner.beginning_of_line? # => true

scanner.concat('x')
scanner.terminate
scanner.beginning_of_line? # => false

StringScanner#bol? is an alias for StringScanner#beginning_of_line?.

Is this handler a streaming handler?

No documentation available
No documentation available

Returns an array of instance variable names for the receiver. Note that simply defining an accessor does not create the corresponding instance variable.

class Fred
  attr_accessor :a1
  def initialize
    @iv = 3
  end
end
Fred.new.instance_variables   #=> [:@iv]

Invoked when a reference is made to an undefined constant in mod. It is passed a symbol for the undefined constant, and returns a value to be used for that constant. For example, consider:

def Foo.const_missing(name)
  name # return the constant name as Symbol
end

Foo::UNDEFINED_CONST    #=> :UNDEFINED_CONST: symbol returned

As the example above shows, const_missing is not required to create the missing constant in mod, though that is often a side-effect. The caller gets its return value when triggered. If the constant is also defined, further lookups won’t hit const_missing and will return the value stored in the constant as usual. Otherwise, const_missing will be invoked again.

In the next example, when a reference is made to an undefined constant, const_missing attempts to load a file whose path is the lowercase version of the constant name (thus class Fred is assumed to be in file fred.rb). If defined as a side-effect of loading the file, the method returns the value stored in the constant. This implements an autoload feature similar to Kernel#autoload and Module#autoload, though it differs in important ways.

def Object.const_missing(name)
  @looked_for ||= {}
  str_name = name.to_s
  raise "Constant not found: #{name}" if @looked_for[str_name]
  @looked_for[str_name] = 1
  file = str_name.downcase
  require file
  const_get(name, false)
end

Returns the Encoding object that represents the encoding of the internal string, if conversion is specified, or nil otherwise.

See Encodings.

Returns the Encoding of the internal string if conversion is specified. Otherwise returns nil.

Search took: 6ms  ·  Total Results: 4239