mousevc 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/console +2 -0
- data/lib/mousevc.rb +2 -3
- data/lib/mousevc/app.rb +1 -1
- data/lib/mousevc/router.rb +1 -2
- data/lib/mousevc/version.rb +1 -1
- data/lib/mousevc/view.rb +9 -4
- 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: 568bf7fd10f91463d4715fd59cbda78648196289
|
4
|
+
data.tar.gz: 32b5275d0bd34f5c8f1dfc7451bb585041b3b116
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ee9ab708ea3d70a53b67b1a674f514dbb6d23a5e20a26c14aa4cefd64b4ef4c919a61ee4d6dab9f730a7814bc305bad903d5a362535959868388b20e93a7ed6
|
7
|
+
data.tar.gz: fed7fdb6f5dcfd0aaeb0c8027b22d345fd34c5d33197682c2502bdc6674eec37d45235b72d257d7ff9e4310ebaa5369c6e221c8b5efc53ebc5186e46e3cc8601
|
data/bin/console
CHANGED
data/lib/mousevc.rb
CHANGED
@@ -39,11 +39,10 @@ module Mousevc
|
|
39
39
|
##
|
40
40
|
# Generates a Mousevc class constant ready for instantiation
|
41
41
|
#
|
42
|
+
# @param class_name [String] the string name of the class
|
42
43
|
# @return [Constant] the class constant
|
43
44
|
|
44
45
|
def self.factory(class_name)
|
45
|
-
|
46
|
-
object.const_get(string)
|
47
|
-
end
|
46
|
+
Mousevc.const_get(class_name)
|
48
47
|
end
|
49
48
|
end
|
data/lib/mousevc/app.rb
CHANGED
@@ -47,7 +47,7 @@ module Mousevc
|
|
47
47
|
# - :controller => [String] name of default controller class
|
48
48
|
# - :model => [String] name of default model class
|
49
49
|
# - :action => [Symbol] method to call on default controller
|
50
|
-
# - :views => [String]
|
50
|
+
# - :views => [String] the absolute path to your views directory
|
51
51
|
# - :looping => [Boolean] +true+ if the application should loop, defaults to +false+
|
52
52
|
# - :system_clear => [Boolean] +true+ if output should be cleared on update, defaults to +false+
|
53
53
|
|
data/lib/mousevc/router.rb
CHANGED
@@ -61,8 +61,7 @@ module Mousevc
|
|
61
61
|
# 1. sending the controller the current action in +@action+
|
62
62
|
|
63
63
|
def route
|
64
|
-
model =
|
65
|
-
model = Persistence.get(@controller.to_sym) unless Persistence.get(@controller.to_sym).nil?
|
64
|
+
model = Persistence.get(@controller.to_sym)
|
66
65
|
model = Persistence.get(@model) if @model.is_a?(Symbol)
|
67
66
|
unless model
|
68
67
|
model = Mousevc.factory(@model).new
|
data/lib/mousevc/version.rb
CHANGED
data/lib/mousevc/view.rb
CHANGED
@@ -11,7 +11,7 @@ module Mousevc
|
|
11
11
|
##
|
12
12
|
# @!attribute dir
|
13
13
|
#
|
14
|
-
# @return [String] the path to the views directory
|
14
|
+
# @return [String] the absolute path to the views directory
|
15
15
|
|
16
16
|
attr_reader :dir
|
17
17
|
|
@@ -40,13 +40,18 @@ module Mousevc
|
|
40
40
|
|
41
41
|
def render(view, *args)
|
42
42
|
data = args[0].is_a?(Hash) ? args[0] : {}
|
43
|
-
output =
|
44
|
-
|
45
|
-
path = "#{
|
43
|
+
output = ! (args[0] == false || args[1] == false)
|
44
|
+
|
45
|
+
path = "#{@dir}/#{view}.txt.erb"
|
46
|
+
|
46
47
|
view = File.file?(path) ? File.read(path) : view
|
48
|
+
|
47
49
|
to_ivars(data)
|
50
|
+
|
48
51
|
result = ERB.new(view).result(binding)
|
52
|
+
|
49
53
|
puts result if output
|
54
|
+
|
50
55
|
result
|
51
56
|
end
|
52
57
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mousevc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Scavello
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|