ruby_lib/fancy.rb in fancy-0.3.1 vs ruby_lib/fancy.rb in fancy-0.3.2

- old
+ new

@@ -1,27 +1,10 @@ base = File.dirname(__FILE__) require File.expand_path("../boot/fancy_ext", base) require File.expand_path("../boot/load", base) -do_retry = true -begin - Fancy::CodeLoader.load_compiled_file File.expand_path("../lib/boot", base) -rescue RuntimeError => e - # need to bootstrap first time - if e.message =~ /File not found (.*)lib\/boot.fyc/ - if do_retry - puts "Fancy hasn't been bootstrapped yet. Doing that now.\n\n" - `cd #{base}/../ && rbx -S rake clean && rbx -S rake` - do_retry = false - retry - else - raise e - end - else - raise e - end -end +Fancy::CodeLoader.load_compiled_file File.expand_path("../lib/boot", base) # Remove the bootstrapping code loader bcl = Fancy.send :remove_const, :CodeLoader bcl.load_compiled_file File.expand_path("../lib/rbx/code_loader", base) @@ -30,14 +13,28 @@ # Load compiler+eval support Fancy::CodeLoader.load_compiled_file File.expand_path("../lib/eval", base) class Object - def fy(hash_or_name) - if hash_or_name.is_a? Hash - self.send("#{hash_or_name.keys.join(':')}:", *hash_or_name.values) + def fancy_message_args name_and_args + method_name = [] + args = [] + name_and_args.each_with_index do |a, i| + if i % 2 == 0 + method_name << a + else + args << a + end + end + return [method_name.join(":") + ":", args] + end + + def fy(*array_or_name) + if array_or_name.size > 1 + message_name, args = fancy_message_args array_or_name + self.send(message_name, *args) else - self.send(":#{hash_or_name}") + self.send(":#{array_or_name}") end end def fancy_require(fancy_file) Fancy::CodeLoader.load_compiled_file fancy_file