Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use Declarative::Option and :Builder instead of
uber
's.
this allows removing the uber version restriction.
- Loading branch information
Showing
7 changed files
with
56 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,5 @@ gem "benchmark-ips" | |
gem "minitest-line" | ||
|
||
gemspec | ||
|
||
gem "uber", path: "../uber" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
require "tilt" | ||
require "uber/inheritable_attr" | ||
require "uber/delegates" | ||
require "cell/version" | ||
|
||
module Cell | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
require "uber/delegates" | ||
|
||
module Cell | ||
class ViewModel | ||
extend Abstract | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require "test_helper" | ||
|
||
# TODO: test caching without rails | ||
|
||
class CacheTest < Minitest::Spec | ||
STORE = Class.new(Hash) do | ||
def fetch(key, options, &block) | ||
self[key] || self[key] = yield | ||
end | ||
end.new | ||
|
||
module Cache | ||
def show | ||
"#{@model}" | ||
end | ||
|
||
def cache_store | ||
STORE | ||
end | ||
end | ||
|
||
class Index < Cell::ViewModel | ||
cache :show | ||
include Cache | ||
end | ||
|
||
it do | ||
Index.new(1).().must_equal("1") | ||
Index.new(2).().must_equal("1") | ||
end | ||
end | ||
|