{"shas":[["b20a1f03e1d09525ef93f1dd25bf0c64612a73a3","7035ebe5eb42135c312c7a720784bf2539cc2c25@ukstudio.jp","SpacerGIF API\n\ndiff --git a/lib/galakei/spacer.rb b/lib/galakei/spacer.rb\nnew file mode 100644\nindex 0000000..3b6f79e\n--- /dev/null\n+++ b/lib/galakei/spacer.rb\n@@ -0,0 +1,27 @@\n+class Spacer\n+  START = '47494638396101000100f70000'\n+  NOT_INCOLOR = '2c000000000100010000080400010404003b'\n+  INCOLOR = '21f90401000000002c000000000100010000080400010404003b'\n+  END_ = 'f'*1530\n+\n+  def self.to_bin(str)\n+    num = str.size\n+    raise if num % 2 != 0\n+    bin = ''\n+    (num/2).times do |i|\n+      bin += (str[2 * (i + 1) - 2,2]).hex.chr\n+    end\n+    return bin\n+  end\n+\n+  def self.create(color = '#ffffff', incolor = false)\n+    color = color.gsub('#','')\n+    hex = START + color + END_\n+    if incolor\n+      hex += INCOLOR\n+    else\n+      hex += NOT_INCOLOR\n+    end\n+    return to_bin(hex)\n+  end\n+end\n\nSpacerGIF API\n\ndiff --git a/lib/galakei/railtie.rb b/lib/galakei/railtie.rb\nindex bdf4129..8c2d738 100644\n--- a/lib/galakei/railtie.rb\n+++ b/lib/galakei/railtie.rb\n@@ -4,6 +4,7 @@ module Galakei\n     initializer \"galakei.extend.action_controller\" do |app|\n       ActiveSupport.on_load :action_controller do\n         include Galakei::HelperMethods\n+        include Galakei::Spacer\n         filters = %w[Views ContentType]\n         filters << :Haml if defined?(Haml)\n         filters.each {|f| Galakei::Filter.const_get(f).inject(self) }\ndiff --git a/lib/galakei/spacer.rb b/lib/galakei/spacer.rb\nindex b3af27b..ced8778 100644\n--- a/lib/galakei/spacer.rb\n+++ b/lib/galakei/spacer.rb\n@@ -1,27 +1,33 @@\n-class Galakei::Spacer\n-  START = '47494638396101000100f70000'\n-  NOT_INCOLOR = '2c000000000100010000080400010404003b'\n-  INCOLOR = '21f90401000000002c000000000100010000080400010404003b'\n-  END_ = 'f'*1530\n+module Galakei\n+  module Spacer\n+    START = '47494638396101000100f70000'\n+    NOT_INCOLOR = '2c000000000100010000080400010404003b'\n+    INCOLOR = '21f90401000000002c000000000100010000080400010404003b'\n+    END_ = 'f'*1530\n\n-  def self.to_bin(str)\n-    num = str.size\n-    raise if num % 2 != 0\n-    bin = ''\n-    (num/2).times do |i|\n-      bin += (str[2 * (i + 1) - 2,2]).hex.chr\n+    def hex_to_bin(str)\n+      num = str.size\n+      raise if num % 2 != 0\n+      bin = ''\n+      (num/2).times do |i|\n+        bin += (str[2 * (i + 1) - 2,2]).hex.chr\n+      end\n+      return bin\n+    end\n+\n+    def create_spacer(color = '#ffffff', incolor = false)\n+      color = color.gsub('#','')\n+      hex = START + color + END_\n+      if incolor\n+        hex += INCOLOR\n+      else\n+        hex += NOT_INCOLOR\n+      end\n+      return hex_to_bin(hex)\n     end\n-    return bin\n-  end\n\n-  def self.create(color = '#ffffff', incolor = false)\n-    color = color.gsub('#','')\n-    hex = START + color + END_\n-    if incolor\n-      hex += INCOLOR\n-    else\n-      hex += NOT_INCOLOR\n+    def spacer(color='#ffffff' ,incolor = false)\n+      send_data(create_spacer(color,incolor), :disposition => \"inline\", :type => \"images/gif\")\n     end\n-    return to_bin(hex)\n   end\n end\n\n[from now] 2011/04/12 11:04:56\n\ndiff --git a/lib/galakei/helper_methods.rb b/lib/galakei/helper_methods.rb\nindex 19d805a..c65e6c4 100644\n--- a/lib/galakei/helper_methods.rb\n+++ b/lib/galakei/helper_methods.rb\n@@ -3,6 +3,7 @@ module Galakei\n     def self.included(klass)\n       klass.helper_method :galakei?\n       klass.helper_method :emoji_table\n+      klass.helper_method :spacer_gif\n     end\n\n     protected\n@@ -22,5 +23,9 @@ module Galakei\n         EmojiTable.unicode\n       end\n     end\n+\n+    def spacer_url(color)\n+      \"<img src='#{spacer_url(:color => color)}'/>\"\n+    end\n   end\n end\ndiff --git a/lib/galakei/spacer.rb b/lib/galakei/spacer.rb\nindex ced8778..6af449e 100644\n--- a/lib/galakei/spacer.rb\n+++ b/lib/galakei/spacer.rb\n@@ -15,7 +15,7 @@ module Galakei\n       return bin\n     end\n\n-    def create_spacer(color = '#ffffff', incolor = false)\n+    def create(color = '#ffffff', incolor = false)\n       color = color.gsub('#','')\n       hex = START + color + END_\n       if incolor\n@@ -25,9 +25,5 @@ module Galakei\n       end\n       return hex_to_bin(hex)\n     end\n-\n-    def spacer(color='#ffffff' ,incolor = false)\n-      send_data(create_spacer(color,incolor), :disposition => \"inline\", :type => \"images/gif\")\n-    end\n   end\n end\n\n[from now] 2011/04/12 11:16:35\n\ndiff --git a/lib/galakei.rb b/lib/galakei.rb\nindex 0a76026..80a6038 100644\n--- a/lib/galakei.rb\n+++ b/lib/galakei.rb\n@@ -1,5 +1,6 @@\n if defined?(Rails)\n   require 'galakei/railtie'\n+  require 'galakei/engine'\n   require 'galakei/use_rack_request_to_extract_sid'\n end\n require 'galakei/request'\n\n[from now] 2011/04/12 11:48:12\n\ndiff --git a/lib/galakei/helper_methods.rb b/lib/galakei/helper_methods.rb\nindex c65e6c4..4ad2d39 100644\n--- a/lib/galakei/helper_methods.rb\n+++ b/lib/galakei/helper_methods.rb\n@@ -1,11 +1,11 @@\n module Galakei\n   module HelperMethods\n+    include ActionView::Helpers::RawOutputHelper\n     def self.included(klass)\n       klass.helper_method :galakei?\n       klass.helper_method :emoji_table\n       klass.helper_method :spacer_gif\n-    end\n-\n+    end\n     protected\n\n     def galakei?\n@@ -24,8 +24,8 @@ module Galakei\n       end\n     end\n\n-    def spacer_url(color)\n-      \"<img src='#{spacer_url(:color => color)}'/>\"\n+    def spacer_gif(color,width = 1, height = 1)\n+      raw \"<img src='#{spacer_path(:color => color)}' width = '#{width}' height = '#{height}'/>\"\n     end\n   end\n end\ndiff --git a/lib/galakei/spacer.rb b/lib/galakei/spacer.rb\nindex 6af449e..8d2cc3c 100644\n--- a/lib/galakei/spacer.rb\n+++ b/lib/galakei/spacer.rb\n@@ -5,7 +5,7 @@ module Galakei\n     INCOLOR = '21f90401000000002c000000000100010000080400010404003b'\n     END_ = 'f'*1530\n\n-    def hex_to_bin(str)\n+    def self.hex_to_bin(str)\n       num = str.size\n       raise if num % 2 != 0\n       bin = ''\n@@ -15,7 +15,8 @@ module Galakei\n       return bin\n     end\n\n-    def create(color = '#ffffff', incolor = false)\n+    def self.create(color = '#ffffff', incolor = nil)\n+      color = '#000000' if color.nil?\n       color = color.gsub('#','')\n       hex = START + color + END_\n       if incolor\n\n[from now] 2011/04/12 12:44:53\n\ndiff --git a/Gemfile b/Gemfile\nindex 93dbfa1..096183b 100644\n--- a/Gemfile\n+++ b/Gemfile\n@@ -4,6 +4,7 @@ source \"http://rubygems.org\"\n gemspec\n\n group :development, :test do\n+  gem 'rails'\n   gem 'rspec', '>= 2.5.0'\n   gem 'capybara'\n   gem 'steak'\ndiff --git a/app/controllers/galakei/spacer_controller.rb b/app/controllers/galakei/spacer_controller.rb\nnew file mode 100644\nindex 0000000..5b687b7\n--- /dev/null\n+++ b/app/controllers/galakei/spacer_controller.rb\n@@ -0,0 +1,10 @@\n+class Galakei::SpacerController < ApplicationController\n+  def create\n+    respond_to do |format|\n+      color,incolor = params[:color],params[:incolor]\n+      format.gif {\n+        send_data(Galakei::Spacer.create(color,incolor), :disposition => \"inline\", :type => :gif)\n+      }\n+    end\n+  end\n+end\ndiff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb\nnew file mode 100644\nindex 0000000..19269fb\n--- /dev/null\n+++ b/config/initializers/mime_types.rb\n@@ -0,0 +1 @@\n+Mime::Type.register 'image/gif', :gif\ndiff --git a/config/routes.rb b/config/routes.rb\nnew file mode 100644\nindex 0000000..718b244\n--- /dev/null\n+++ b/config/routes.rb\n@@ -0,0 +1,3 @@\n+ Rails.application.routes.draw do |map|\n+   match 'spacer' => 'galakei/spacer#create', :format => :gif\n+ end\ndiff --git a/lib/galakei.rb b/lib/galakei.rb\nindex 80a6038..dc23488 100644\n--- a/lib/galakei.rb\n+++ b/lib/galakei.rb\n@@ -13,6 +13,7 @@ module Galakei\n   autoload :InputMode, \"galakei/input_mode\"\n   autoload :EmojiTable, \"galakei/emoji_table\"\n   autoload :SessionIdParameterInForm, \"galakei/session_id_parameter_in_form\"\n+  autoload :Spacer, \"galakei/spacer\"\n   module Filter\n     autoload :Base, \"galakei/filter/base\"\n     autoload :ContentType, \"galakei/filter/content_type\"\ndiff --git a/lib/galakei/engine.rb b/lib/galakei/engine.rb\nnew file mode 100644\nindex 0000000..095b1ac\n--- /dev/null\n+++ b/lib/galakei/engine.rb\n@@ -0,0 +1,4 @@\n+module Galakei\n+  class Engine < Rails::Engine #:nodoc:\n+  end\n+end","AKAMATSU Yuki"],["7202cd33d390070db04432f71a88e3d7a0c72ca7","7035ebe5eb42135c312c7a720784bf2539cc2c25@ukstudio.jp","Fix spec for emoji_table","AKAMATSU Yuki"],["3ecda2744f32460d251746cff3383460b268759b","7035ebe5eb42135c312c7a720784bf2539cc2c25@ukstudio.jp","Add transparent option","AKAMATSU Yuki"],["50484027d4fb851264314acef8c830c6e5fb7042","7035ebe5eb42135c312c7a720784bf2539cc2c25@ukstudio.jp","Add spec for Galakei::SpacerController","AKAMATSU Yuki"]],"repo":"mobalean/galakei","actor":"ukstudio","ref":"refs/heads/master","size":4,"head":"50484027d4fb851264314acef8c830c6e5fb7042","actor_gravatar":"15e2d5cb578d7dc3147fc2be901ecd5f","push_id":28901407}