hud 2.2.0 → 2.3.0

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/hud/version.rb +1 -1
  3. data/lib/hud.rb +17 -0
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd14aa710d44347443dcb1e30575b50c873a22d051f20281bb5d1aa33b00fb82
4
- data.tar.gz: e6af8ae9a8703fa028f88b1d2d379080abec3864eec58fa9244fc5ac3f28f071
3
+ metadata.gz: 1c81ae686bbd0cd97c469d98c2baaaab165e50859bcd8e40325b31d20baedf95
4
+ data.tar.gz: 7debdf245e083c85c681c058b73281a74fe3c9d82492606cce23bd6efd21312d
5
5
  SHA512:
6
- metadata.gz: f05b56d9e6d079724b108fd6f060268c220333c5cb90c6ca8249cd5bf3b77037be0c23e6b288fb77ddb4cc0e5d9f2d9e890c29393e256e26fea23a07de687862
7
- data.tar.gz: 6b260356cd613124088dbc77ea4dd0ff5ad9944862e5324a4ceb4b865eefc0098d97dbe4902d3623a599f5b256123b866afb0922dd4144caebb3210c5fe8411b
6
+ metadata.gz: 8a3d655457bc738523a5eb1fec70ccbbf2f79561a7751db775fe72953761a8c9e47b30045d658db04b723c7376ed25fb0f0448fca17404cce1f312f66777f5cb
7
+ data.tar.gz: 8e6f24a2ed10b1e9f0675beaa1e6b74885da602c3a0c3aa33f20fb9dec1b650b61c602758573578c84ea640c82fe65920950dac4e6660b00c8016ba710b75e0e
data/lib/hud/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Hud
2
- VERSION = '2.2.0'
2
+ VERSION = '2.3.0'
3
3
  end
data/lib/hud.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "rack/app"
2
2
  require "yaml"
3
3
  require "tilt"
4
+ require "pry"
4
5
  require "ostruct"
5
6
  require "tilt/erb"
6
7
  require "rack/app/front_end"
@@ -15,6 +16,7 @@ module Hud
15
16
 
16
17
  def self.configure
17
18
  configuration.components_dirs = []
19
+ configuration.base_path = Pathname.new(Rack::App::Utils.pwd)
18
20
  yield(configuration)
19
21
  end
20
22
  module Middleware
@@ -85,6 +87,9 @@ module Hud
85
87
  klz = Display.build(name)
86
88
  klz.call(locals: locals).render_template(name: name, locals: @locals, from: from)
87
89
  end
90
+ alias_method :render, :display
91
+ alias_method :d, :display
92
+ alias_method :r, :display
88
93
  end
89
94
 
90
95
  def self.build(name)
@@ -98,6 +103,7 @@ module Hud
98
103
  attr_reader :locals
99
104
  attr_reader :content
100
105
  alias_method :args, :locals
106
+
101
107
 
102
108
  def folders
103
109
  Hud.configuration.components_dirs
@@ -107,6 +113,16 @@ module Hud
107
113
  ENV["RACK_ENV"] == "development"
108
114
  end
109
115
 
116
+
117
+ def display(name, locals: {})
118
+ template = Tilt::ERBTemplate.new("#{Hud.configuration.base_path}/components/#{name.to_s}.html.erb")
119
+ template.render(self, locals)
120
+ end
121
+
122
+ alias_method :render, :display
123
+ alias_method :d, :display
124
+ alias_method :r, :display
125
+
110
126
  def production?
111
127
  ENV["RACK_ENV"] == "production"
112
128
  end
@@ -137,6 +153,7 @@ module Hud
137
153
  if File.exist?(path)
138
154
  template = Tilt::ERBTemplate.new(path)
139
155
 
156
+ puts path
140
157
  if from.nil?
141
158
  return template.render(self, locals)
142
159
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hud
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delaney Kuldvee Burke