Need to delete old cache files. (rm -rf ./tmp/*)
and, change the syntax.
# before| def a(**options) | |
| options | |
| end | |
| def b(**options) | |
| a(foo: true, **options) | |
| end | |
| # 2.1だと{:foo=>true}, 2.2だと{:foo=>false}が出力される。 | |
| # 2.1が正しいように思う。 |
| require 'forwardable' | |
| class Regexp | |
| class Trie | |
| def self.union(*patterns) | |
| trie = new | |
| patterns.each { |pattern| trie << pattern } | |
| trie.to_regexp | |
| end |
| require 'fileutils' | |
| require 'RMagick' | |
| require 'streamio-ffmpeg' | |
| class Turmeric | |
| DEFAULT_OPTIONS = { | |
| tmp_dir: "./tmp/", | |
| resolution: "200x100", | |
| duration: ->(movie){ movie.duration.to_i.times } | |
| }.freeze |
| class A | |
| attr_writer :foo | |
| def test(k) | |
| [respond_to?(:"#{k}="), respond_to?("#{k}=")] | |
| end | |
| end | |
| a = A.new | |
| p a.respond_to?(:test) #=> true | |
| p a.respond_to?("test") #=> true |
| diff --git a/padrino-core/lib/padrino-core/reloader.rb b/padrino-core/lib/padrino-core/reloader.rb | |
| index d157017..f990c6d 100644 | |
| --- a/padrino-core/lib/padrino-core/reloader.rb | |
| +++ b/padrino-core/lib/padrino-core/reloader.rb | |
| @@ -223,6 +223,7 @@ module Padrino | |
| files = Set.new | |
| files += Dir.glob("#{Padrino.root}/{lib,models,shared}/**/*.rb") | |
| reloadable_apps.each do |app| | |
| + next unless app.app_file.start_with?(Padrino.root) | |
| files << app.app_file |
| diff --git a/Gemfile b/Gemfile | |
| index aa19617..fa847b7 100644 | |
| --- a/Gemfile | |
| +++ b/Gemfile | |
| @@ -21,6 +21,7 @@ gem 'slim' | |
| # Padrino Stable Gem | |
| gem 'padrino', '0.12.2' | |
| +gem 'rack-parser' | |
| module Foobar | |
| class App < Padrino::Application | |
| enable :sessions | |
| configure :development do | |
| use BetterErrors::Middleware | |
| BetterErrors.application_root = PADRINO_ROOT | |
| set :protect_from_csrf, except: %r{/__better_errors/\d+/\w+\z} | |
| end | |
| .... |
| require 'MeCab' | |
| require 'kconv' | |
| class MecabParser | |
| def initialize(param = nil) | |
| @mecab = param ? MeCab::Tagger.new(param) : MeCab::Tagger.new | |
| end | |
| def parse(str) | |
| @mecab.parse(str).split(/\n/).inject([]) do |data, line| |
| module Sandbox | |
| class App < Padrino::Application | |
| register Padrino::Helpers | |
| register Padrino::Cache | |
| enable :caching | |
| get :test, "/test/:test_id", :cache => true do |test_id| | |
| cache_key test_id | |
| test_id | |
| end |