rfc2822

rfc2822() Instance Public methods Returns a string of the object's date and time in the RFC 2822 standard format. Time.zone.now.rfc2822 # => "Tue, 01 Jan 2013 04:51:39 +0000" rfc822

write 2

ios.write(string) â integer Instance Public methods Writes the given string to ios. The stream must be opened for writing. If the argument is not a string, it will be converted to a string using to_s. Returns the number of bytes written. count = $stdout.write("This is a test\n") puts "That was #{count} bytes of data" produces: This is a test That was 15 bytes of data

default_scope

default_scope(scope = nil) Instance Protected methods Use this macro in your model to set a default scope for all operations on the model. class Article < ActiveRecord::Base default_scope { where(published: true) } end Article.all # => SELECT * FROM articles WHERE published = true The default_scope is also applied while creating/building a record. It is not applied while updating a record. Article.new.published # => true Article.create.published # => true (You c

num_of_mainwindows

num_of_mainwindows() Class Public methods

find_or_create_by

find_or_create_by(attributes, &block) Instance Public methods Finds the first record with the given attributes, or creates a record with the attributes if one is not found: # Find the first user named "Penélope" or create a new one. User.find_or_create_by(first_name: 'Penélope') # => #<User id: 1, first_name: "Penélope", last_name: nil> # Find the first user named "Penélope" or create a new one. # We already have one so the existing record will be returned. User.f

&lt;=

<=(set) Instance Public methods Alias for: subset?

up

up() Instance Public methods

sbstub

sbstub(sb, cmd, num, units = 'units') Instance Public methods sbstub Used as the :command option for a scrollbar, updates the scrollbar's position.

seconds_to_utc_offset

seconds_to_utc_offset(seconds, colon = true) Class Public methods Assumes self represents an offset from UTC in seconds (as returned from Time#utc_offset) and turns this into an +HH:MM formatted string. TimeZone.seconds_to_utc_offset(-21_600) # => "-06:00"

each

struct.each {|obj| block } â structstruct.each â an_enumerator Instance Public methods Calls block once for each instance variable, passing the value as a parameter. If no block is given, an enumerator is returned instead. Customer = Struct.new(:name, :address, :zip) joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345) joe.each {|x| puts(x) } produces: Joe Smith 123 Maple, Anytown NC 12345