mousevc 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7f9e6f8b4214f83c3b7cbcc43312bea114d591d0
4
- data.tar.gz: d18164a76e24423db98aaa71176a48936af776aa
3
+ metadata.gz: 568bf7fd10f91463d4715fd59cbda78648196289
4
+ data.tar.gz: 32b5275d0bd34f5c8f1dfc7451bb585041b3b116
5
5
  SHA512:
6
- metadata.gz: 5f76490bee2c6e714d730875b5a0363f56dc60074b9850d7e143fe964c9a068714831380fd377c9c8ffead8cc1ce504e397bb95fd5c202a313de421ee54b7436
7
- data.tar.gz: fc0e0528cff18a5c971bb02917fb86020db4c895793d5c0cd397cde34fb9b996655d161dfa0e8bda61a2115e7535e11f2116fb82661cffc87d14d16200cd8bf6
6
+ metadata.gz: 6ee9ab708ea3d70a53b67b1a674f514dbb6d23a5e20a26c14aa4cefd64b4ef4c919a61ee4d6dab9f730a7814bc305bad903d5a362535959868388b20e93a7ed6
7
+ data.tar.gz: fed7fdb6f5dcfd0aaeb0c8027b22d345fd34c5d33197682c2502bdc6674eec37d45235b72d257d7ff9e4310ebaa5369c6e221c8b5efc53ebc5186e46e3cc8601
data/bin/console CHANGED
@@ -3,6 +3,8 @@
3
3
  require "bundler/setup"
4
4
  require "mousevc"
5
5
 
6
+ Mousevc::App.new.run
7
+
6
8
  # You can add fixtures and/or initialization code here to make experimenting
7
9
  # with your gem easier. You can also use a different console, if you like.
8
10
 
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
- "Mousevc::#{class_name}".split('::').inject(Object) do |object, string|
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] relative path to views directory
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
 
@@ -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 = nil
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
@@ -3,5 +3,5 @@ module Mousevc
3
3
  ##
4
4
  # The current version
5
5
 
6
- VERSION = "0.0.4"
6
+ VERSION = "0.0.5"
7
7
  end
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 = true
44
- output = false if args[0] == false || args[1] == false
45
- path = "#{Dir.pwd}/#{@dir}/#{view}.txt.erb"
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
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-24 00:00:00.000000000 Z
11
+ date: 2015-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler