repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/range/overlap_spec.rb | spec/motion-support/core_ext/range/overlap_spec.rb | describe "Range" do
describe "overlaps?" do
it "should overlaps last inclusive" do
(1..5).overlaps?(5..10).should.be.true
end
it "should overlaps last exclusive" do
(1...5).overlaps?(5..10).should.be.false
end
it "should overlaps first inclusive" do
(5..10).overlaps?(1..5).shou... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/time/calculation_spec.rb | spec/motion-support/core_ext/time/calculation_spec.rb | describe "Time" do
describe "calculations" do
describe "seconds_since_midnight" do
it "should calculate correctly" do
Time.local(2005,1,1,0,0,1).seconds_since_midnight.should == 1
Time.local(2005,1,1,0,1,0).seconds_since_midnight.should == 60
Time.local(2005,1,1,1,1,0).seconds_since_... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/time/acts_like_spec.rb | spec/motion-support/core_ext/time/acts_like_spec.rb | describe "Time" do
describe "acts_like" do
it "should act like time" do
Time.now.should.acts_like(:time)
end
it "should not act like date" do
Time.now.should.not.acts_like(:date)
end
end
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/time/conversion_spec.rb | spec/motion-support/core_ext/time/conversion_spec.rb | describe "Time" do
describe "conversions" do
describe "to_formatted_s" do
before do
@time = Time.utc(2005, 2, 21, 17, 44, 30.12345678901)
end
it "should use default conversion if no parameter is given" do
@time.to_s.should == @time.to_default_s
end
it "should use de... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/object/blank_spec.rb | spec/motion-support/core_ext/object/blank_spec.rb | class EmptyTrue
def empty?() true; end
end
class EmptyFalse
def empty?() false; end
end
BLANK = [ EmptyTrue.new, nil, false, '', ' ', " \n\t \r ", ' ', [], {} ]
NOT = [ EmptyFalse.new, Object.new, true, 0, 1, 'a', [nil], { nil => 0 } ]
describe "blank" do
describe "blank?" do
BLANK.each do |v|
... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/object/instance_variable_spec.rb | spec/motion-support/core_ext/object/instance_variable_spec.rb | describe "Object" do
before do
@source = Object.new
@source.instance_variable_set(:@bar, 'bar')
@source.instance_variable_set(:@baz, 'baz')
end
describe "instance_variable_names" do
it "should return all instance variable names" do
@source.instance_variable_names.sort.should == %w(@bar @b... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/object/acts_like_spec.rb | spec/motion-support/core_ext/object/acts_like_spec.rb | class DuckFoo
def acts_like_foo?
true
end
end
describe "Object" do
describe "acts_like" do
it "should not act like anything" do
object = Object.new
object.should.not.acts_like(:time)
object.should.not.acts_like(:date)
object.should.not.acts_like(:foo)
end
it "should a... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/object/to_param_spec.rb | spec/motion-support/core_ext/object/to_param_spec.rb | class ArrayToParam < String
def to_param
"#{self}1"
end
end
class HashToParam < String
def to_param
"#{self}-1"
end
end
describe "to_param" do
describe "object" do
it "should delegate to to_s" do
foo = Object.new
def foo.to_s; 'foo' end
foo.to_param.should == 'foo'
end
en... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/object/try_spec.rb | spec/motion-support/core_ext/object/try_spec.rb | describe "Object" do
before do
@string = "Hello"
end
describe "try" do
it "should return nil for nonexisting method" do
method = :undefined_method
@string.should.not.respond_to method
@string.try(method).should.be.nil
end
it "should return nil for nonexisting method with argume... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/object/to_query_spec.rb | spec/motion-support/core_ext/object/to_query_spec.rb | class Should
def equal_query(query)
@object.to_query.split('&').should == query.split('&')
end
end
describe "to_query" do
it "should do a simple converion" do
{ :a => 10 }.should.equal_query 'a=10'
end
it "should escape for CGI" do
{ 'a:b' => 'c d' }.should.equal_query 'a%3Ab=c+d'
end
it ... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/object/deep_dup_spec.rb | spec/motion-support/core_ext/object/deep_dup_spec.rb | describe "deep_dup" do
describe "array" do
it "should deep_dup nested array" do
array = [1, [2, 3]]
dup = array.deep_dup
dup[1][2] = 4
array[1][2].should.be.nil
dup[1][2].should == 4
end
it "should deep_dup array with hash inside" do
array = [1, { :a => 2, :b => 3 ... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/object/inclusion_spec.rb | spec/motion-support/core_ext/object/inclusion_spec.rb | class LifeUniverseAndEverything
def include?(obj)
obj == 42
end
end
describe 'array' do
describe "in?" do
it "should support arrays" do
1.in?([1,2,3]).should == true
0.in?([1,2,3]).should == false
end
it "should support hashes" do
:a.in?({a:1,b:2,c:3}).should == true
1.i... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/object/to_json_spec.rb | spec/motion-support/core_ext/object/to_json_spec.rb | describe ".to_json" do
describe "object" do
it "should serialize attributes" do
foo = Object.new
class << foo
attr_accessor :test
end
foo.test = 'bar'
foo.to_json.should == '{"test":"bar"}'
end
end
describe "nil" do
it "should return null" do
nil.to_json.s... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/object/duplicable_spec.rb | spec/motion-support/core_ext/object/duplicable_spec.rb | describe "duplicable?" do
before do
@raise_dup = [nil, false, true]
@yes = ['1', Object.new, /foo/, [], {}, Time.now, Class.new, Module.new]
@no = []
end
it "should return false for non-duplicable objects" do
(@raise_dup + @no).each do |v|
v.should.not.be.duplicable
end
end
it "sho... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/date_and_time/calculation_spec.rb | spec/motion-support/core_ext/date_and_time/calculation_spec.rb | class Date
def self.for_spec(year, month, day, hour, minute, second, usec)
new(year, month, day)
end
end
class Time
def self.for_spec(year, month, day, hour, minute, second, usec)
local(year, month, day, hour, minute, second, usec)
end
end
[Date, Time].each do |klass|
describe klass do
@klass = ... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/array/prepend_and_append_spec.rb | spec/motion-support/core_ext/array/prepend_and_append_spec.rb | describe 'array' do
describe "prepend" do
it "should add an element to the front of the array" do
[1, 2, 3].prepend(0).should == [0, 1, 2, 3]
end
it "should change the array" do
array = [1, 2, 3]
array.prepend(0)
array.should == [0, 1, 2, 3]
end
end
describe "append... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/array/conversion_spec.rb | spec/motion-support/core_ext/array/conversion_spec.rb | describe 'array' do
describe "to_sentence" do
it "should convert plain array" do
[].to_sentence.should == ""
['one'].to_sentence.should == "one"
['one', 'two'].to_sentence.should == "one and two"
['one', 'two', 'three'].to_sentence.should == "one, two, and three"
end
it "shoul... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/array/wrap_spec.rb | spec/motion-support/core_ext/array/wrap_spec.rb | describe 'array' do
describe "wrap" do
it "should return empty array for nil" do
Array.wrap(nil).should == []
end
it "should return unchanged array for array" do
Array.wrap([1, 2, 3]).should == [1, 2, 3]
end
it "should not flatten multidimensional array" do
Array.wrap([... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/array/grouping_spec.rb | spec/motion-support/core_ext/array/grouping_spec.rb | describe 'array grouping' do
describe "in_groups_of" do
it "should group array and fill rest with nil" do
%w(1 2 3 4 5 6 7 8 9 10).in_groups_of(3).should == [
["1", "2", "3"],
["4", "5", "6"],
["7", "8", "9"],
["10", nil, nil]
]
end
it "should group array a... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/array/access_spec.rb | spec/motion-support/core_ext/array/access_spec.rb | describe 'array access' do
describe "from" do
it "should return the tail of an array from position" do
['a', 'b', 'c', 'd'].from(0).should == ["a", "b", "c", "d"]
['a', 'b', 'c', 'd'].from(2).should == ["c", "d"]
['a', 'b', 'c', 'd'].from(10).should == []
[].from(0).should == []
end
... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/array/extract_options_spec.rb | spec/motion-support/core_ext/array/extract_options_spec.rb | describe 'array options' do
describe "extract_options!" do
it "should extract an options hash from an array" do
[1, 2, :a => :b].extract_options!.should == { :a => :b }
end
it "should return an empty hash if the last element is not a hash" do
[1, 2].extract_options!.should == {}
end
... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/class/attribute_spec.rb | spec/motion-support/core_ext/class/attribute_spec.rb | describe "class" do
describe "class_attribute" do
before do
@klass = Class.new
@klass.class_eval { class_attribute :setting }
@sub = Class.new(@klass)
end
it "should default to nil" do
@klass.setting.should.be.nil
@sub.setting.should.be.nil
end
it "should be inherit... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/class/attribute_accessor_spec.rb | spec/motion-support/core_ext/class/attribute_accessor_spec.rb | class CAttrAccessorBase
cattr_accessor :empty_accessor
cattr_accessor :base_accessor, :derived_accessor
end
class CAttrAccessorDerived < CAttrAccessorBase
end
describe "class" do
describe "attribute accessors" do
before do
@class = Class.new
@class.instance_eval do
cattr_accessor :foo
... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/module/attr_internal_spec.rb | spec/motion-support/core_ext/module/attr_internal_spec.rb | describe "module" do
describe "attr_internal" do
before do
@target = Class.new
@instance = @target.new
end
describe "reader" do
it "should define reader" do
lambda { @target.attr_internal_reader :foo }.should.not.raise
end
describe "defined" do
before do... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/module/aliasing_spec.rb | spec/motion-support/core_ext/module/aliasing_spec.rb | module Aliasing
class File
public
def open(file)
end
def open_with_internet(url)
open_without_internet(url)
end
alias_method_chain :open, :internet
protected
def exist?(file)
end
def exist_with_internet?(url)
exist_without_internet?(url)
end
alias_method_chai... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/module/remove_method_spec.rb | spec/motion-support/core_ext/module/remove_method_spec.rb | module RemoveMethodSpec
class A
def do_something
return 1
end
end
end
describe "module" do
describe "remove_method" do
it "should remove a method from an object" do
RemoveMethodSpec::A.class_eval {
self.remove_possible_method(:do_something)
}
RemoveMethodSpec::A.new.sh... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/module/anonymous_spec.rb | spec/motion-support/core_ext/module/anonymous_spec.rb | describe "module" do
describe "anonymous?" do
it "should return true for an anonymous module" do
Module.new.anonymous?.should == true
end
it "should return true for an anonymous class" do
Class.new.anonymous?.should == true
end
it "should return false for a named module" do
... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/module/introspection_spec.rb | spec/motion-support/core_ext/module/introspection_spec.rb | module ModuleIntrospection
module Foo
module Bar
end
end
module Baz
end
end
ModuleIntrospectionAlias = ModuleIntrospection::Foo
describe "module" do
describe "introspection" do
describe "parent_name" do
it "should return nil for top-level module" do
ModuleIntrospection.parent_name.s... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/module/attribute_accessor_spec.rb | spec/motion-support/core_ext/module/attribute_accessor_spec.rb | describe "module" do
describe "attribute accessors" do
before do
m = @module = Module.new
@module.instance_eval do
mattr_accessor :foo
mattr_accessor :bar, :instance_writer => false
mattr_reader :shaq, :instance_reader => false
mattr_accessor :camp, :instance_accessor... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/module/reachable_spec.rb | spec/motion-support/core_ext/module/reachable_spec.rb | describe "Module" do
describe "reachable?" do
it "should be false for an anonymous module" do
Module.new.should.not.be.reachable
end
it "should be false for an anonymous class" do
Class.new.should.not.be.reachable
end
it "should be true for a named module" do
Kernel.should.... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/module/delegation_spec.rb | spec/motion-support/core_ext/module/delegation_spec.rb | module ModuleDelegation
class Delegator
def receive
"result"
end
end
class InstanceVariable
def initialize
@instance_variable = Delegator.new
end
delegate :receive, :to => '@instance_variable'
end
class ClassVariable
def initialize
@@class_variable = Delegator.n... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/numeric/conversions_spec.rb | spec/motion-support/core_ext/numeric/conversions_spec.rb | describe "Numeric" do
describe "conversions" do
describe "phone" do
it "should format phone number without area code" do
5551234.to_s(:phone).should == "555-1234"
end
it "should format long number without area code" do
225551212.to_s(:phone).should == "22-555-1212"
... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/core_ext/numeric/bytes_spec.rb | spec/motion-support/core_ext/numeric/bytes_spec.rb | describe "Numeric" do
describe "bytes" do
it "should calculate kilobytes" do
1.kilobyte.should == 1024.bytes
3.kilobytes.should == 3072
3.kilobyte.should == 3072
end
it "should calculate megabytes" do
1.megabyte.should == 1024.kilobytes
3.5.megabytes.should == 3584.0.kil... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/_helpers/constantize_test_cases.rb | spec/motion-support/_helpers/constantize_test_cases.rb | module Ace
module Base
class Case
class Dice
end
end
class Fase < Case
end
end
class Gas
include Base
end
end
class Object
module AddtlGlobalConstants
class Case
class Dice
end
end
end
include AddtlGlobalConstants
end
module ConstantizeTestCases
def ... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/spec/motion-support/_helpers/inflector_test_cases.rb | spec/motion-support/_helpers/inflector_test_cases.rb | module InflectorTestCases
SingularToPlural = {
"search" => "searches",
"switch" => "switches",
"fix" => "fixes",
"box" => "boxes",
"process" => "processes",
"address" => "addresses",
"case" => "cases",
"stack" => "stacks",
"wish" ... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/examples/Inflector/app/app_delegate.rb | examples/Inflector/app/app_delegate.rb | class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
@window.rootViewController = UINavigationController.alloc.initWithRootViewController(InflectorViewController.alloc.init)
@window.makeKeyAndVisible
... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/examples/Inflector/app/inflector_view_controller.rb | examples/Inflector/app/inflector_view_controller.rb | class InflectorViewController < Formotion::FormController
def init
initWithForm(build_form)
self.title = "Inflector"
@form.on_submit do |form|
submit(form)
end
self
end
def submit(form)
data = form.render
original = String.new(data[:word])
update_fields(original)
... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/examples/Inflector/app/words_view_controller.rb | examples/Inflector/app/words_view_controller.rb | class WordsViewController < UITableViewController
WORDS = [
[
"Single words",
%w{
alias
axis
buffalo
bus
cat
child
cow
crisis
dog
house
man
matrix
mouse
move
octopus
ox
... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/examples/Inflector/app/inflections.rb | examples/Inflector/app/inflections.rb | MotionSupport::Inflector.inflections do |inflect|
inflect.acronym 'HTML'
inflect.acronym 'API'
inflect.acronym 'BSD'
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/examples/Inflector/spec/main_spec.rb | examples/Inflector/spec/main_spec.rb | describe "Application 'Inflector'" do
before do
@app = UIApplication.sharedApplication
end
it "has one window" do
@app.windows.size.should == 1
end
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/lib/motion-support.rb | lib/motion-support.rb | unless defined?(Motion::Project::Config)
raise "This file must be required within a RubyMotion project Rakefile."
end
require 'motion-support/motion_support_files'
Motion::Project::App.setup do |app|
app.files.unshift(MotionSupport.requires)
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/lib/motion-support/core_ext.rb | lib/motion-support/core_ext.rb | require_relative 'motion_support_files'
Motion::Project::App.setup do |app|
app.files.unshift(MotionSupport.core_ext_files)
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/lib/motion-support/inflector.rb | lib/motion-support/inflector.rb | require_relative 'motion_support_files'
Motion::Project::App.setup do |app|
app.files.unshift(MotionSupport.inflector_files)
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/lib/motion-support/callbacks.rb | lib/motion-support/callbacks.rb | require_relative 'motion_support_files'
Motion::Project::App.setup do |app|
app.files.unshift(MotionSupport.callbacks_files)
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/lib/motion-support/motion_support_files.rb | lib/motion-support/motion_support_files.rb | require_relative 'core_ext/core_ext_files'
module MotionSupport
class << self
def callbacks_files
%w(
_stdlib/array
concern
descendants_tracker
callbacks
core_ext/kernel/singleton_class
).map { |file| self.map_file_to_motion_dir(file) }
end
def concern... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/lib/motion-support/concern.rb | lib/motion-support/concern.rb | require_relative 'motion_support_files'
Motion::Project::App.setup do |app|
app.files.unshift(MotionSupport.concern_files)
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/lib/motion-support/core_ext/range.rb | lib/motion-support/core_ext/range.rb | require_relative 'core_ext_files'
Motion::Project::App.setup do |app|
app.files.unshift(MotionSupport.range_files)
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/lib/motion-support/core_ext/array.rb | lib/motion-support/core_ext/array.rb | require_relative 'core_ext_files'
Motion::Project::App.setup do |app|
app.files.unshift(MotionSupport.array_files)
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/lib/motion-support/core_ext/time.rb | lib/motion-support/core_ext/time.rb | require_relative 'core_ext_files'
Motion::Project::App.setup do |app|
app.files.unshift(MotionSupport.time_files)
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/lib/motion-support/core_ext/class.rb | lib/motion-support/core_ext/class.rb | require_relative 'core_ext_files'
Motion::Project::App.setup do |app|
app.files.unshift(MotionSupport.class_files)
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/lib/motion-support/core_ext/string.rb | lib/motion-support/core_ext/string.rb | require_relative 'core_ext_files'
Motion::Project::App.setup do |app|
app.files.unshift(MotionSupport.string_files)
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/lib/motion-support/core_ext/object.rb | lib/motion-support/core_ext/object.rb | require_relative 'core_ext_files'
Motion::Project::App.setup do |app|
app.files.unshift(MotionSupport.object_files)
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/lib/motion-support/core_ext/core_ext_files.rb | lib/motion-support/core_ext/core_ext_files.rb | module MotionSupport
class << self
def array_files
%w(
core_ext/array
core_ext/array/wrap
core_ext/array/access
core_ext/array/conversions
core_ext/array/extract_options
core_ext/array/grouping
core_ext/array/prepend_and_append
).map { |file| sel... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/lib/motion-support/core_ext/integer.rb | lib/motion-support/core_ext/integer.rb | require_relative 'core_ext_files'
Motion::Project::App.setup do |app|
app.files.unshift(MotionSupport.integer_files)
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/lib/motion-support/core_ext/module.rb | lib/motion-support/core_ext/module.rb | require_relative 'core_ext_files'
Motion::Project::App.setup do |app|
app.files.unshift(MotionSupport.module_files)
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/lib/motion-support/core_ext/hash.rb | lib/motion-support/core_ext/hash.rb | require_relative 'core_ext_files'
Motion::Project::App.setup do |app|
app.files.unshift(MotionSupport.hash_files)
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/lib/motion-support/core_ext/numeric.rb | lib/motion-support/core_ext/numeric.rb | require_relative 'core_ext_files'
Motion::Project::App.setup do |app|
app.files.unshift(MotionSupport.numeric_files)
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/version.rb | motion/version.rb | module MotionSupport
VERSION = "1.2.1"
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/duration.rb | motion/duration.rb | module MotionSupport
# Provides accurate date and time measurements using Date#advance and
# Time#advance, respectively. It mainly supports the methods on Numeric.
#
# 1.month.ago # equivalent to Time.now.advance(months: -1)
class Duration < BasicObject
attr_accessor :value, :parts
def initia... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/logger.rb | motion/logger.rb | module Kernel
def log(*args)
MotionSupport.logger.log(*args)
end
def l(*args)
MotionSupport.logger.log(args.map { |a| a.inspect })
end
end
module MotionSupport
class NullLogger
def log(*args)
end
end
class StdoutLogger
def log(*args)
puts args
end
end
class Networ... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/callbacks.rb | motion/callbacks.rb | module MotionSupport
# Callbacks are code hooks that are run at key points in an object's lifecycle.
# The typical use case is to have a base class define a set of callbacks
# relevant to the other functionality it supplies, so that subclasses can
# install callbacks that enhance or modify the base functionalit... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/descendants_tracker.rb | motion/descendants_tracker.rb | module MotionSupport
# This module provides an internal implementation to track descendants
# which is faster than iterating through ObjectSpace.
module DescendantsTracker
@@direct_descendants = {}
class << self
def direct_descendants(klass)
@@direct_descendants[klass] || []
end
... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/hash_with_indifferent_access.rb | motion/hash_with_indifferent_access.rb | module MotionSupport
# Implements a hash where keys <tt>:foo</tt> and <tt>"foo"</tt> are considered
# to be the same.
#
# rgb = MotionSupport::HashWithIndifferentAccess.new
#
# rgb[:black] = '#000000'
# rgb[:black] # => '#000000'
# rgb['black'] # => '#000000'
#
# rgb['white'] = '#FFFFFF'
... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/inflections.rb | motion/inflections.rb | module MotionSupport
Inflector.inflections do |inflect|
inflect.plural(/$/, 's')
inflect.plural(/s$/i, 's')
inflect.plural(/^(ax|test)is$/i, '\1es')
inflect.plural(/(octop|vir)us$/i, '\1i')
inflect.plural(/(octop|vir)i$/i, '\1i')
inflect.plural(/(alias|status)$/i, '\1es')
inflect.plural(/(... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/concern.rb | motion/concern.rb | module MotionSupport
# A typical module looks like this:
#
# module M
# def self.included(base)
# base.extend ClassMethods
# base.class_eval do
# scope :disabled, -> { where(disabled: true) }
# end
# end
#
# module ClassMethods
# ...
# end
# ... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/number_helper.rb | motion/number_helper.rb | module MotionSupport
module NumberHelper
extend self
# Formats a +number+ into a US phone number (e.g., (555)
# 123-9876). You can customize the format in the +options+ hash.
#
# ==== Options
#
# * <tt>:area_code</tt> - Adds parentheses around the area code.
# * <tt>:delimiter</tt> - ... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/inflector/methods.rb | motion/inflector/methods.rb | module MotionSupport
# The Inflector transforms words from singular to plural, class names to table
# names, modularized class names to ones without, and class names to foreign
# keys. The default inflections for pluralization, singularization, and
# uncountable words are kept in inflections.rb.
module Inflec... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/inflector/inflections.rb | motion/inflector/inflections.rb | module MotionSupport
module Inflector
extend self
# A singleton instance of this class is yielded by Inflector.inflections,
# which can then be used to specify additional inflection rules.
#
# MotionSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1\2en'
# ... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/_stdlib/array.rb | motion/_stdlib/array.rb | class Array
def reverse_each
return to_enum(:reverse_each) unless block_given?
i = size - 1
while i >= 0
yield self[i]
i -= 1
end
self
end
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/_stdlib/time.rb | motion/_stdlib/time.rb | class Time
def to_date
Date.new(year, month, day)
end
def to_time
self
end
def ==(other)
other &&
year == other.year &&
month == other.month &&
day == other.day &&
hour == other.hour &&
min == other.min &&
sec == other.sec
end
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/_stdlib/enumerable.rb | motion/_stdlib/enumerable.rb | module Enumerable
def reverse_each(&block)
return to_enum(:reverse_each) unless block_given?
# There is no other way then to convert to an array first... see 1.9's source.
to_a.reverse_each(&block)
self
end
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/_stdlib/cgi.rb | motion/_stdlib/cgi.rb | # This is a very small part of the CGI class, borrowed from the Rubinius sources
class CGI
@@accept_charset="UTF-8" unless defined?(@@accept_charset)
# URL-encode a string.
# url_encoded_string = CGI::escape("'Stop!' said Fred")
# # => "%27Stop%21%27+said+Fred"
def CGI::escape(string)
string.gsub(/... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/_stdlib/date.rb | motion/_stdlib/date.rb | class Date
def self.gregorian_leap?(year)
if year % 400 == 0
true
elsif year % 100 == 0 then
false
elsif year % 4 == 0 then
true
else
false
end
end
def initialize(year = nil, month = nil, day = nil)
if year && month && day
@value = Time.utc(year, month, day... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/ns_dictionary.rb | motion/core_ext/ns_dictionary.rb | class NSDictionary
def to_hash
Hash.new.tap do |h|
h.replace self
end
end
delegate :symbolize_keys, :symbolize_keys!, :deep_symbolize_keys, :deep_symbolize_keys!,
:stringify_keys, :stringify_keys!, :deep_stringify_keys!, :deep_stringify_keys,
:deep_transform_keys, :deep_transform_keys!,
... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/array.rb | motion/core_ext/array.rb | class Array
# If any item in the array has the key == `key` true, otherwise false.
# Of good use when writing specs.
def has_hash_key?(key)
self.each do |entity|
return true if entity.has_key? key
end
return false
end
# If any item in the array has the value == `key` true, otherwise false
... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/enumerable.rb | motion/core_ext/enumerable.rb | module Enumerable
# Iterates through a container, yielding each element and its index to the given block.
def collect_with_index(&block)
index = 0
collect do |value|
block.call(value, index).tap do
index += 1
end
end
end
# Calculates a sum from the elements.
#
# payments.su... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/ns_string.rb | motion/core_ext/ns_string.rb | class NSString
def to_s
String.new(self)
end
delegate :at, :blank?, :camelcase, :camelize, :classify, :constantize, :dasherize,
:deconstantize, :demodulize, :exclude?, :first, :foreign_key, :from, :humanize,
:indent, :indent!, :last, :pluralize, :safe_constantize, :singularize,
... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/regexp.rb | motion/core_ext/regexp.rb | class Regexp #:nodoc:
def multiline?
options & MULTILINE == MULTILINE
end
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/metaclass.rb | motion/core_ext/metaclass.rb | class Object
# Returns an object's metaclass.
def metaclass
class << self
self
end
end
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/string/indent.rb | motion/core_ext/string/indent.rb | class String
# Same as +indent+, except it indents the receiver in-place.
#
# Returns the indented string, or +nil+ if there was nothing to indent.
def indent!(amount, indent_string=nil, indent_empty_lines=false)
indent_string = indent_string || self[/^[ \t]/] || ' '
re = indent_empty_lines ? /^/ : /^(?... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/string/strip.rb | motion/core_ext/string/strip.rb | class String
# Strips indentation in heredocs.
#
# For example in
#
# if options[:usage]
# puts <<-USAGE.strip_heredoc
# This command does such and such.
#
# Supported options are:
# -h This message
# ...
# USAGE
# end
#
# the user would see ... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/string/access.rb | motion/core_ext/string/access.rb | class String
# If you pass a single Fixnum, returns a substring of one character at that
# position. The first character of the string is at position 0, the next at
# position 1, and so on. If a range is supplied, a substring containing
# characters at offsets given by the range is returned. In both cases, if a... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/string/starts_ends_with.rb | motion/core_ext/string/starts_ends_with.rb | class String
alias_method :starts_with?, :start_with?
alias_method :ends_with?, :end_with?
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/string/inflections.rb | motion/core_ext/string/inflections.rb | # String inflections define new methods on the String class to transform names for different purposes.
# For instance, you can figure out the name of a table from the name of a class.
#
# 'ScaleScore'.tableize # => "scale_scores"
#
class String
# Returns the plural form of the word in the string.
#
# If the opt... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/string/filters.rb | motion/core_ext/string/filters.rb | class String
# Returns the string, first removing all whitespace on both ends of
# the string, and then changing remaining consecutive whitespace
# groups into one space each.
#
# Note that it handles both ASCII and Unicode whitespace like mongolian vowel separator (U+180E).
#
# %{ Multi-line
# s... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/string/exclude.rb | motion/core_ext/string/exclude.rb | class String
# The inverse of <tt>String#include?</tt>. Returns true if the string
# does not include the other string.
#
# "hello".exclude? "lo" #=> false
# "hello".exclude? "ol" #=> true
# "hello".exclude? ?h #=> false
def exclude?(string)
!include?(string)
end
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/string/behavior.rb | motion/core_ext/string/behavior.rb | class String
# Enable more predictable duck-typing on String-like classes. See <tt>Object#acts_like?</tt>.
def acts_like_string?
true
end
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/hash/slice.rb | motion/core_ext/hash/slice.rb | class Hash
# Slice a hash to include only the given keys. This is useful for
# limiting an options hash to valid keys before passing to a method:
#
# def search(criteria = {})
# criteria.assert_valid_keys(:mass, :velocity, :time)
# end
#
# search(options.slice(:mass, :velocity, :time))
#
#... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/hash/reverse_merge.rb | motion/core_ext/hash/reverse_merge.rb | class Hash
# Merges the caller into +other_hash+. For example,
#
# options = options.reverse_merge(size: 25, velocity: 10)
#
# is equivalent to
#
# options = { size: 25, velocity: 10 }.merge(options)
#
# This is particularly useful for initializing an options hash
# with default values.
def re... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/hash/keys.rb | motion/core_ext/hash/keys.rb | class Hash
# Return a new hash with all keys converted using the block operation.
#
# hash = { name: 'Rob', age: '28' }
#
# hash.transform_keys{ |key| key.to_s.upcase }
# # => { "NAME" => "Rob", "AGE" => "28" }
def transform_keys
result = {}
each_key do |key|
result[yield(key)] = self[key... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/hash/indifferent_access.rb | motion/core_ext/hash/indifferent_access.rb | class Hash
# Returns an <tt>MotionSupport::HashWithIndifferentAccess</tt> out of its receiver:
#
# { a: 1 }.with_indifferent_access['a'] # => 1
def with_indifferent_access
MotionSupport::HashWithIndifferentAccess.new_from_hash_copying_default(self)
end
# Called when object is nested under an object t... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/hash/deep_merge.rb | motion/core_ext/hash/deep_merge.rb | class Hash
# Returns a new hash with +self+ and +other_hash+ merged recursively.
#
# h1 = { x: { y: [4,5,6] }, z: [7,8,9] }
# h2 = { x: { y: [7,8,9] }, z: 'xyz' }
#
# h1.deep_merge(h2) #=> {x: {y: [7, 8, 9]}, z: "xyz"}
# h2.deep_merge(h1) #=> {x: {y: [4, 5, 6]}, z: [7, 8, 9]}
# h1.deep_merge(h... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/hash/except.rb | motion/core_ext/hash/except.rb | class Hash
# Return a hash that includes everything but the given keys. This is useful for
# limiting a set of parameters to everything but a few known toggles:
#
# @person.update(params[:person].except(:admin))
def except(*keys)
dup.except!(*keys)
end
# Replaces the hash without the given keys.
... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/hash/deep_delete_if.rb | motion/core_ext/hash/deep_delete_if.rb | class Hash
# Returns a new hash with keys deleted if they match a criteria
# h1 = { x: { y: [ { z: 4, y: 1 }, 5, 6] }, a: { b: 2 } }
#
# h1.deep_delete { |k,v| k == :z } #=> { x: { y: [ { y: 1 }, 5, 6] }, a: { b: 2 } }
# h1.deep_delete { |k,v| k == :y } #=> { x: {}, a: { b: 2 } }
def deep_delete_if... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/date/conversions.rb | motion/core_ext/date/conversions.rb | class Date
DATE_FORMATS = {
:short => '%e %b',
:long => '%B %e, %Y',
:db => '%Y-%m-%d',
:number => '%Y%m%d',
:long_ordinal => lambda { |date|
day_format = MotionSupport::Inflector.ordinalize(date.day)
date.strftime("%B #{day_format}, %Y") # => "April 25th... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/date/acts_like.rb | motion/core_ext/date/acts_like.rb | class Date
# Duck-types as a Date-like class. See Object#acts_like?.
def acts_like_date?
true
end
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/date/calculations.rb | motion/core_ext/date/calculations.rb | class Date
include DateAndTime::Calculations
class << self
attr_accessor :beginning_of_week_default
# Returns the week start (e.g. :monday) for the current request, if this has been set (via Date.beginning_of_week=).
# If <tt>Date.beginning_of_week</tt> has not been set for the current request, return... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/integer/time.rb | motion/core_ext/integer/time.rb | class Integer
# Enables the use of time calculations and declarations, like <tt>45.minutes +
# 2.hours + 4.years</tt>.
#
# These methods use Time#advance for precise date calculations when using
# <tt>from_now</tt>, +ago+, etc. as well as adding or subtracting their
# results from a Time object.
#
# #... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/integer/inflections.rb | motion/core_ext/integer/inflections.rb | class Integer
# Ordinalize turns a number into an ordinal string used to denote the
# position in an ordered sequence such as 1st, 2nd, 3rd, 4th.
#
# 1.ordinalize # => "1st"
# 2.ordinalize # => "2nd"
# 1002.ordinalize # => "1002nd"
# 1003.ordinalize # => "1003rd"
# -11.ordinalize # => "... | ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
rubymotion-community/motion-support | https://github.com/rubymotion-community/motion-support/blob/f9e04234315327a64db8181e3af2c7b87ba3e13a/motion/core_ext/integer/multiple.rb | motion/core_ext/integer/multiple.rb | class Integer
# Check whether the integer is evenly divisible by the argument.
#
# 0.multiple_of?(0) #=> true
# 6.multiple_of?(5) #=> false
# 10.multiple_of?(2) #=> true
def multiple_of?(number)
number != 0 ? self % number == 0 : zero?
end
end
| ruby | MIT | f9e04234315327a64db8181e3af2c7b87ba3e13a | 2026-01-04T17:47:41.763315Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.