Skip to content

Commit 4ba070d

Browse files
committed
Array#to_h not available in vanilla RubyMotion
1 parent ee3afd3 commit 4ba070d

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

lib/motion-markdown-it-plugins/emoji/plugin/normalize_opts.rb

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,10 @@ def quoteRE(str)
66
str.gsub(/([.?*+^$\[\]\\(){}|-])/, '\\\\\1')
77
end
88

9-
# convert keys from symbols into strings
10-
#------------------------------------------------------------------------------
11-
def stringify(symbol_hash)
12-
symbol_hash.collect{|k,v| [k.to_s, v]}.to_h
13-
end
14-
159
#------------------------------------------------------------------------------
1610
def normalize_opts(options)
17-
emojies = stringify(options[:defs])
18-
shortcuts = stringify(options[:shortcuts])
11+
emojies = stringify_keys(options[:defs])
12+
shortcuts = stringify_keys(options[:shortcuts])
1913

2014
# Filter emojies by whitelist, if needed
2115
if options[:enabled].length > 0
@@ -63,6 +57,16 @@ def normalize_opts(options)
6357
replaceRE: replaceRE
6458
}
6559
end
60+
61+
private
62+
63+
# convert keys from symbols into strings
64+
#------------------------------------------------------------------------------
65+
def stringify_keys(symbol_hash)
66+
result = {}
67+
symbol_hash.each_key { |key| result[key.to_s] = symbol_hash[key] }
68+
result
69+
end
6670
end
6771
end
6872
end

rubymotion/Rakefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ Motion::Project::App.setup do |app|
2222

2323
app.detect_dependencies = true
2424
end
25+
26+
desc "Open app with a command line console"
27+
task :console => :run

0 commit comments

Comments
 (0)