yuba 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/yuba/rendering.rb +1 -1
- data/lib/yuba/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 338f5b0c508bb1e8df93486999e6d06025f0efdd
|
4
|
+
data.tar.gz: 69e9080eeddb78312be8475bd71f078aaae6947c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5418fb02dd94930ed5b273bbbaf77cf4dad46d89c0bafb84bf4a2257d76266fb1987a19c8671aeed71bae4f78b068c991942a24797318ff59773a4880554fbf
|
7
|
+
data.tar.gz: 104a17016bbc0a247f03ff21a4e87eab9fcc7c2a4f86c0d10618cc8a32fb2b8d10d572805a8a938ce5932e44b51834e5834c8ac27f32f6f9ce9a9f3f72cb4f3c
|
data/README.md
CHANGED
@@ -80,7 +80,7 @@ Property is default to private. This means you can use it in internal the instan
|
|
80
80
|
You can use ViewModel in a controller like following
|
81
81
|
|
82
82
|
```ruby
|
83
|
-
class PostsController
|
83
|
+
class PostsController < ApplicationController
|
84
84
|
def show
|
85
85
|
@view_model = PostViewModel.new(post: post, author: 'willnet')
|
86
86
|
end
|
@@ -90,7 +90,7 @@ end
|
|
90
90
|
In view template, if you want to access post and author, you have to use `@view_model` instance variable like `@view_model.post.title`. if it feels troublesome, you can write like following
|
91
91
|
|
92
92
|
```ruby
|
93
|
-
class PostsController
|
93
|
+
class PostsController < ApplicationController
|
94
94
|
def show
|
95
95
|
view_model = PostViewModel.new(post: post, author: 'willnet')
|
96
96
|
render view_model: view_model
|
data/lib/yuba/rendering.rb
CHANGED
@@ -2,7 +2,7 @@ module Yuba
|
|
2
2
|
module Rendering
|
3
3
|
def render(*args)
|
4
4
|
view_model_hash = args.find { |arg| arg.is_a?(Hash) && arg[:view_model] }
|
5
|
-
@_view_model = view_model_hash[:view_model] if view_model_hash[:view_model]
|
5
|
+
@_view_model = view_model_hash[:view_model] if view_model_hash && view_model_hash[:view_model]
|
6
6
|
super
|
7
7
|
end
|
8
8
|
|
data/lib/yuba/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yuba
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- willnet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|