from_json

from_json(json, include_root=include_root_in_json) Instance Public methods Sets the model attributes from a JSON string. Returns self. class Person include ActiveModel::Serializers::JSON attr_accessor :name, :age, :awesome def attributes=(hash) hash.each do |key, value| send("#{key}=", value) end end def attributes instance_values end end json = { name: 'bob', age: 22, awesome:true }.to_json person = Person.new person.from_json(json) # => #<P

setpos

setpos(y, x) Class Public methods A setter for the position of the cursor, using coordinates x and y

as_json

as_json(options = nil) Instance Public methods Returns a hash representing the model. Some configuration can be passed through options. The option include_root_in_json controls the top-level behavior of as_json. If true, as_json will emit a single root node named after the object's type. The default value for include_root_in_json option is false. user = User.find(1) user.as_json # => { "id" => 1, "name" => "Konata Izumi", "age" => 16, # "created_at" => "2006/08/0

constantize

constantize(camel_cased_word) Instance Public methods Tries to find a constant with the name specified in the argument string. 'Module'.constantize # => Module 'Test::Unit'.constantize # => Test::Unit The name is assumed to be the one of a top-level constant, no matter whether it starts with â::â or not. No lexical context is taken into account: C = 'outside' module M C = 'inside' C # => 'inside' 'C'.constantize # => 'outside', same as ::C end

xml_getter

xml_getter() Class Public methods

read_ids1_with_locations

read_ids1_with_locations(path) Instance Public methods

actual_hash

actual_hash(fnt, option=nil) Class Public methods

screencells

screencells(win) Class Public methods

alias_target

alias_target(aliascmd, slave = '') Class Public methods

plural

plural(record_or_class) Class Public methods Returns the plural class name of a record or class. ActiveModel::Naming.plural(post) # => "posts" ActiveModel::Naming.plural(Highrise::Person) # => "highrise_people"