GitHub PullRequestReviewCommentEvent at 2014-05-15 04:27:57
Repository: assembler
Actor: benhamill
Payload: {"comment":{"url":"https://api.github.com/repos/benhamill/assembler/pulls/comments/12673754","id":12673754,"diff_hunk":"@@ -4,32 +4,33 @@\n module Assembler\n   module Initializer\n     def initialize(options={})\n-      if self.class.before_assembly_blocks.any?\n-        self.class.before_assembly_blocks.each do |block|\n-          instance_eval(&block)\n-        end\n+      self.class.before_assembly_blocks.each do |block|\n+        instance_eval(&block)\n       end\n \n-      builder = Assembler::Builder.new(self.class.assembly_parameters_hash, options)\n+      builder = Assembler::Builder.new(self, self.class.assembly_parameters_hash)\n+      methods = self.class.assembly_parameters.flat_map(&:name_and_aliases)\n \n-      yield builder if block_given?\n-\n-      missing_required_parameters = []\n+      self.class.assembly_parameters.select(&:has_default?).each do |param|\n+        builder.send(\"#{param.name}=\", param.default)\n+      end\n \n-      self.class.assembly_parameters.each do |param|\n-        if_required_and_missing = -> { missing_required_parameters << param.name }\n+      options.each do |param_name, value|\n+        builder.send(\"#{param_name.to_sym}=\", value) if methods.include?(param_name.to_sym)","path":"lib/assembler/initializer.rb","position":26,"original_position":26,"commit_id":"2ed5c12eaeae11b53e1f3477122f8fb81f4cefbf","original_commit_id":"2ed5c12eaeae11b53e1f3477122f8fb81f4cefbf","user":{"login":"benhamill","id":25421,"avatar_url":"https://avatars.githubusercontent.com/u/25421?","gravatar_id":"4938b4569f1366168b705ce9c774ea5e","url":"https://api.github.com/users/benhamill","html_url":"https://github.com/benhamill","followers_url":"https://api.github.com/users/benhamill/followers","following_url":"https://api.github.com/users/benhamill/following{/other_user}","gists_url":"https://api.github.com/users/benhamill/gists{/gist_id}","starred_url":"https://api.github.com/users/benhamill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benhamill/subscriptions","organizations_url":"https://api.github.com/users/benhamill/orgs","repos_url":"https://api.github.com/users/benhamill/repos","events_url":"https://api.github.com/users/benhamill/events{/privacy}","received_events_url":"https://api.github.com/users/benhamill/received_events","type":"User","site_admin":false},"body":"The method name is going to be a string, anyway. No reason to call `to_sym` on `param_name` and a possible memory-bloat attack vector (sending in huge strings as param keys). With that in mine, `name_and_aliases` should probably return an array of Strings.","created_at":"2014-05-15T04:27:57Z","updated_at":"2014-05-15T04:27:57Z","html_url":"https://github.com/benhamill/assembler/pull/20#discussion_r12673754","pull_request_url":"https://api.github.com/repos/benhamill/assembler/pulls/20","_links":{"self":{"href":"https://api.github.com/repos/benhamill/assembler/pulls/comments/12673754"},"html":{"href":"https://github.com/benhamill/assembler/pull/20#discussion_r12673754"},"pull_request":{"href":"https://api.github.com/repos/benhamill/assembler/pulls/20"}}}}