Skip to content

Instantly share code, notes, and snippets.

@mwise
Created February 22, 2015 18:41
Show Gist options
  • Save mwise/dd1d9a5fab19f229d09f to your computer and use it in GitHub Desktop.
Save mwise/dd1d9a5fab19f229d09f to your computer and use it in GitHub Desktop.
motion-env warning with some arrays of at least four hashes
# -*- coding: utf-8 -*-
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project/template/ios'
require "bundler/gem_tasks"
require "bundler/setup"
begin
require 'bundler'
Bundler.require
rescue LoadError
end
Motion::Project::App.setup do |app|
# Use `rake config' to see complete project settings.
app.name = 'motion-env'
app.ENV['hash'] = {herp: "derp"}
app.ENV['empty_hash'] = {}
app.env['string'] = "Sup dog"
app.env["int"] = 3
app.env["bool"] = false
app.env["array"] = [1,2,3]
app.env["complex"] = [{hello: "world", array: [1,2,3]}, {something: :else}]
# This throws a 'encountered \r in middle of line' warning
app.env["array_of_hashes_with_same_four_keys"] = [
{"a"=>"b0", "c"=>"d0", "e"=>"f0", "g" => "h0"},
{"a"=>"b1", "c"=>"d1", "e"=>"f1", "g" => "h1"}
]
# This does not throw a warning
#app.env["array_of_hashes_with_different_four_keys"] = [
#{"a"=>"b0", "c"=>"d0", "e"=>"f0", "g" => "h0"},
#{"a"=>"b1", "c"=>"d1", "e"=>"f1", "g1" => "h1"}
#]
# This does't throw a warning, either
#app.env["array_of_hashes_with_same_three_keys"] = [
#{"a"=>"b0", "c"=>"d0", "e"=>"f0"},
#{"a"=>"b1", "c"=>"d1", "e"=>"f1"}
#]
class Person
attr_accessor :name, :age
def initialize(name, age)
@name = name
@age = age
end
end
app.env["object"] = Person.new("clay", 3)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment