html_format 0.0.9 → 0.0.11
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/.ruby-version +1 -0
- data/Gemfile +5 -1
- data/README.org +0 -1
- data/Rakefile +3 -31
- data/examples/0140_mongoid.rb +9 -6
- data/html_format.gemspec +1 -1
- data/lib/html_format/core_ext.rb +3 -3
- data/lib/html_format/version.rb +1 -1
- data/lib/html_format.rb +1 -1
- data/{test/html_format_test.rb → spec/html_format_spec.rb} +17 -10
- metadata +13 -110
- data/.travis.yml +0 -3
- data/test/dummy/README.rdoc +0 -28
- data/test/dummy/Rakefile +0 -6
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/javascripts/application.js +0 -1
- data/test/dummy/app/assets/stylesheets/application.css +0 -6
- data/test/dummy/app/controllers/application_controller.rb +0 -12
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/controllers/welcome_controller.rb +0 -46
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/helpers/welcome_helper.rb +0 -2
- data/test/dummy/app/mailers/.keep +0 -0
- data/test/dummy/app/models/.keep +0 -0
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/bin/bundle +0 -3
- data/test/dummy/bin/rails +0 -4
- data/test/dummy/bin/rake +0 -4
- data/test/dummy/bin/setup +0 -29
- data/test/dummy/config/application.rb +0 -26
- data/test/dummy/config/boot.rb +0 -5
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -41
- data/test/dummy/config/environments/production.rb +0 -79
- data/test/dummy/config/environments/test.rb +0 -42
- data/test/dummy/config/initializers/assets.rb +0 -11
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/cookies_serializer.rb +0 -3
- data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/test/dummy/config/initializers/inflections.rb +0 -16
- data/test/dummy/config/initializers/mime_types.rb +0 -4
- data/test/dummy/config/initializers/session_store.rb +0 -3
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.bootstrap.yml +0 -23
- data/test/dummy/config/locales/en.yml +0 -23
- data/test/dummy/config/routes.rb +0 -4
- data/test/dummy/config/secrets.yml +0 -22
- data/test/dummy/config.ru +0 -4
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +0 -15
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/log/.keep +0 -0
- data/test/dummy/public/404.html +0 -67
- data/test/dummy/public/422.html +0 -67
- data/test/dummy/public/500.html +0 -66
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/test/controllers/welcome_controller_test.rb +0 -9
- data/test/test_helper.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47fede04929cba5980e3127714c611f198518e8f60c05daeb0fea1a3c99b11cb
|
4
|
+
data.tar.gz: b0790548dcf5802ec117f4ed73ca7135107d8243c7f5287ab178bbd57b34360a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b27142b1386af3609151d351f2508ad9bf6879bef8c602e4df524384b71ec8b0951dd2aa66667d1e531f681524bdca085491c60682defd77efd94e1faa9fbe50
|
7
|
+
data.tar.gz: c88a0b8eec15d8d5784754432ca21d54a702e8fe51af14a2247fb410517f0859ec993b40004a21e90855d22834f314b4c03b5be3ebd6b25c71916ffa6104ddfb
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.2.2
|
data/Gemfile
CHANGED
data/README.org
CHANGED
data/Rakefile
CHANGED
@@ -1,33 +1,5 @@
|
|
1
|
-
begin
|
2
|
-
require 'bundler/setup'
|
3
|
-
rescue LoadError
|
4
|
-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
-
end
|
6
|
-
|
7
|
-
require 'rdoc/task'
|
8
|
-
|
9
|
-
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
-
rdoc.rdoc_dir = 'rdoc'
|
11
|
-
rdoc.title = 'HtmlFormat'
|
12
|
-
rdoc.options << '--line-numbers'
|
13
|
-
rdoc.rdoc_files.include('README.rdoc')
|
14
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
-
end
|
16
|
-
|
17
|
-
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
-
load 'rails/tasks/engine.rake'
|
19
|
-
|
20
|
-
load 'rails/tasks/statistics.rake'
|
21
|
-
|
22
1
|
Bundler::GemHelper.install_tasks
|
23
2
|
|
24
|
-
require
|
25
|
-
|
26
|
-
|
27
|
-
t.libs << 'lib'
|
28
|
-
t.libs << 'test'
|
29
|
-
t.pattern = 'test/**/*_test.rb'
|
30
|
-
t.verbose = false
|
31
|
-
end
|
32
|
-
|
33
|
-
task default: :test
|
3
|
+
require "rspec/core/rake_task"
|
4
|
+
RSpec::Core::RakeTask.new
|
5
|
+
task :default => :spec
|
data/examples/0140_mongoid.rb
CHANGED
@@ -14,10 +14,13 @@ end
|
|
14
14
|
|
15
15
|
['alice', 'bob', 'carol'].each { |e| User.create!(name: e) }
|
16
16
|
|
17
|
-
html_format User # =>
|
18
|
-
html_format User.first # =>
|
19
|
-
html_format User.limit(1) # =>
|
17
|
+
html_format User # =>
|
18
|
+
html_format User.first # =>
|
19
|
+
html_format User.limit(1) # =>
|
20
20
|
|
21
|
-
User.to_html # =>
|
22
|
-
User.first.to_html # =>
|
23
|
-
User.limit(1).to_html # =>
|
21
|
+
User.to_html # =>
|
22
|
+
User.first.to_html # =>
|
23
|
+
User.limit(1).to_html # =>
|
24
|
+
# ~> <internal:/usr/local/var/rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:148:in `require': cannot load such file -- mongoid (LoadError)
|
25
|
+
# ~> from <internal:/usr/local/var/rbenv/versions/3.2.1/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:148:in `require'
|
26
|
+
# ~> from -:3:in `<main>'
|
data/html_format.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_dependency 'activesupport'
|
23
23
|
spec.add_dependency 'actionpack'
|
24
24
|
|
25
|
-
spec.add_development_dependency 'bundler'
|
25
|
+
spec.add_development_dependency 'bundler'
|
26
26
|
spec.add_development_dependency 'rake'
|
27
27
|
spec.add_development_dependency "rails"
|
28
28
|
spec.add_development_dependency "sass-rails"
|
data/lib/html_format/core_ext.rb
CHANGED
@@ -3,12 +3,12 @@ require 'active_support/core_ext/kernel/concern'
|
|
3
3
|
module HtmlFormat
|
4
4
|
concern :ActiveRecord do
|
5
5
|
class_methods do
|
6
|
-
def to_html(
|
6
|
+
def to_html(options = {})
|
7
7
|
HtmlFormat.generate(all.collect(&:attributes), options)
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
def to_html(
|
11
|
+
def to_html(options = {})
|
12
12
|
HtmlFormat.generate(attributes, options)
|
13
13
|
end
|
14
14
|
end
|
@@ -32,7 +32,7 @@ end
|
|
32
32
|
|
33
33
|
[Array, Symbol, String, Hash, Numeric, TrueClass, FalseClass, NilClass].each do |e|
|
34
34
|
e.class_eval do
|
35
|
-
def to_html(
|
35
|
+
def to_html(options = {})
|
36
36
|
HtmlFormat.generate(self, options)
|
37
37
|
end
|
38
38
|
end
|
data/lib/html_format/version.rb
CHANGED
data/lib/html_format.rb
CHANGED
@@ -1,22 +1,29 @@
|
|
1
|
-
require
|
1
|
+
# require "rspec/autorun"
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
RSpec.configure do |config|
|
4
|
+
config.expect_with :test_unit
|
5
|
+
end
|
6
|
+
|
7
|
+
require "html_format"
|
8
|
+
|
9
|
+
|
10
|
+
describe do
|
11
|
+
before do
|
5
12
|
HtmlFormat.default_options[:table_class] = ["foo"]
|
6
13
|
end
|
7
14
|
|
8
|
-
|
15
|
+
it "html_format" do
|
9
16
|
assert_nil html_format(nil)
|
10
17
|
assert_equal "<div class=\"html_format html_format_depth_0\"><table class=\"foo html_format_type_object\"><tbody><tr><td>1</td></tr></tbody></table></div>", html_format(1)
|
11
18
|
end
|
12
19
|
|
13
|
-
|
20
|
+
it "to_html" do
|
14
21
|
assert_equal "<div class=\"html_format html_format_depth_0\"><table class=\"foo html_format_type_object\"><tbody><tr><td>1</td></tr></tbody></table></div>", 1.to_html
|
15
22
|
assert_nil [].to_html
|
16
23
|
assert_nil "".to_html
|
17
24
|
end
|
18
25
|
|
19
|
-
|
26
|
+
it "array of hash" do
|
20
27
|
v = [
|
21
28
|
{id: 1, name: "alice", created_at: "2000-01-01"},
|
22
29
|
{id: 2, name: "bob", created_at: "2000-01-02"},
|
@@ -25,12 +32,12 @@ class HtmlFormatTest < ActiveSupport::TestCase
|
|
25
32
|
assert_equal "<div class=\"html_format html_format_depth_0\"><table class=\"foo html_format_type_array_of_hash\"><thead><tr><th>id</th><th>name</th><th>created_at</th></tr></thead><tbody><tr><td>1</td><td>alice</td><td>2000-01-01</td></tr><tr><td>2</td><td>bob</td><td>2000-01-02</td></tr><tr><td>3</td><td>carol</td><td>2000-01-03</td></tr></tbody></table></div>", v.to_html
|
26
33
|
end
|
27
34
|
|
28
|
-
|
35
|
+
it "hash"do
|
29
36
|
v = {id: 1, name: "alice", created_at: "2000-01-01"}
|
30
37
|
assert_equal "<div class=\"html_format html_format_depth_0\"><table class=\"foo html_format_type_hash\"><tr><th>id</th><td>1</td></tr><tr><th>name</th><td>alice</td></tr><tr><th>created_at</th><td>2000-01-01</td></tr></table></div>", v.to_html
|
31
38
|
end
|
32
39
|
|
33
|
-
|
40
|
+
it "array of array" do
|
34
41
|
v = [
|
35
42
|
[1, 2, 3],
|
36
43
|
[4, 5, 6],
|
@@ -39,11 +46,11 @@ class HtmlFormatTest < ActiveSupport::TestCase
|
|
39
46
|
assert_equal "<div class=\"html_format html_format_depth_0\"><table class=\"foo html_format_type_array_of_array\"><tbody><tr><td>1</td><td>2</td><td>3</td></tr><tr><td>4</td><td>5</td><td>6</td></tr><tr><td>7</td><td>8</td><td>9</td></tr></tbody></table></div>", v.to_html
|
40
47
|
end
|
41
48
|
|
42
|
-
|
49
|
+
it "array" do
|
43
50
|
assert_equal "<div class=\"html_format html_format_depth_0\"><table class=\"foo html_format_type_array\"><tbody><tr><td>0</td><td>1</td><td>2</td><td>3</td></tr></tbody></table></div>", [0, 1, 2, 3].to_html
|
44
51
|
end
|
45
52
|
|
46
|
-
|
53
|
+
it "title option" do
|
47
54
|
assert_equal "<div class=\"html_format html_format_depth_0\"><h2 class=\"title\">(title)</h2><table class=\"foo html_format_type_array\"><tbody><tr><td>0</td></tr></tbody></table></div>", [0].to_html(title: "(title)")
|
48
55
|
end
|
49
56
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: html_format
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- akicho8
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,7 +115,7 @@ extensions: []
|
|
115
115
|
extra_rdoc_files: []
|
116
116
|
files:
|
117
117
|
- ".gitignore"
|
118
|
-
- ".
|
118
|
+
- ".ruby-version"
|
119
119
|
- Gemfile
|
120
120
|
- LICENSE.txt
|
121
121
|
- MIT-LICENSE
|
@@ -135,59 +135,11 @@ files:
|
|
135
135
|
- lib/html_format/engine.rb
|
136
136
|
- lib/html_format/generator.rb
|
137
137
|
- lib/html_format/version.rb
|
138
|
-
-
|
139
|
-
- test/dummy/Rakefile
|
140
|
-
- test/dummy/app/assets/images/.keep
|
141
|
-
- test/dummy/app/assets/javascripts/application.js
|
142
|
-
- test/dummy/app/assets/stylesheets/application.css
|
143
|
-
- test/dummy/app/controllers/application_controller.rb
|
144
|
-
- test/dummy/app/controllers/concerns/.keep
|
145
|
-
- test/dummy/app/controllers/welcome_controller.rb
|
146
|
-
- test/dummy/app/helpers/application_helper.rb
|
147
|
-
- test/dummy/app/helpers/welcome_helper.rb
|
148
|
-
- test/dummy/app/mailers/.keep
|
149
|
-
- test/dummy/app/models/.keep
|
150
|
-
- test/dummy/app/models/concerns/.keep
|
151
|
-
- test/dummy/app/views/layouts/application.html.erb
|
152
|
-
- test/dummy/bin/bundle
|
153
|
-
- test/dummy/bin/rails
|
154
|
-
- test/dummy/bin/rake
|
155
|
-
- test/dummy/bin/setup
|
156
|
-
- test/dummy/config.ru
|
157
|
-
- test/dummy/config/application.rb
|
158
|
-
- test/dummy/config/boot.rb
|
159
|
-
- test/dummy/config/database.yml
|
160
|
-
- test/dummy/config/environment.rb
|
161
|
-
- test/dummy/config/environments/development.rb
|
162
|
-
- test/dummy/config/environments/production.rb
|
163
|
-
- test/dummy/config/environments/test.rb
|
164
|
-
- test/dummy/config/initializers/assets.rb
|
165
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
166
|
-
- test/dummy/config/initializers/cookies_serializer.rb
|
167
|
-
- test/dummy/config/initializers/filter_parameter_logging.rb
|
168
|
-
- test/dummy/config/initializers/inflections.rb
|
169
|
-
- test/dummy/config/initializers/mime_types.rb
|
170
|
-
- test/dummy/config/initializers/session_store.rb
|
171
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
172
|
-
- test/dummy/config/locales/en.bootstrap.yml
|
173
|
-
- test/dummy/config/locales/en.yml
|
174
|
-
- test/dummy/config/routes.rb
|
175
|
-
- test/dummy/config/secrets.yml
|
176
|
-
- test/dummy/db/development.sqlite3
|
177
|
-
- test/dummy/db/schema.rb
|
178
|
-
- test/dummy/lib/assets/.keep
|
179
|
-
- test/dummy/log/.keep
|
180
|
-
- test/dummy/public/404.html
|
181
|
-
- test/dummy/public/422.html
|
182
|
-
- test/dummy/public/500.html
|
183
|
-
- test/dummy/public/favicon.ico
|
184
|
-
- test/dummy/test/controllers/welcome_controller_test.rb
|
185
|
-
- test/html_format_test.rb
|
186
|
-
- test/test_helper.rb
|
138
|
+
- spec/html_format_spec.rb
|
187
139
|
homepage: https://github.com/akicho8/html_format
|
188
140
|
licenses: []
|
189
141
|
metadata: {}
|
190
|
-
post_install_message:
|
142
|
+
post_install_message:
|
191
143
|
rdoc_options:
|
192
144
|
- "--line-numbers"
|
193
145
|
- "--inline-source"
|
@@ -207,58 +159,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
207
159
|
- !ruby/object:Gem::Version
|
208
160
|
version: '0'
|
209
161
|
requirements: []
|
210
|
-
|
211
|
-
|
212
|
-
signing_key:
|
162
|
+
rubygems_version: 3.4.10
|
163
|
+
signing_key:
|
213
164
|
specification_version: 4
|
214
165
|
summary: A small library that easily converts various objects to HTML.
|
215
166
|
test_files:
|
216
|
-
-
|
217
|
-
- test/dummy/Rakefile
|
218
|
-
- test/dummy/app/assets/images/.keep
|
219
|
-
- test/dummy/app/assets/javascripts/application.js
|
220
|
-
- test/dummy/app/assets/stylesheets/application.css
|
221
|
-
- test/dummy/app/controllers/application_controller.rb
|
222
|
-
- test/dummy/app/controllers/concerns/.keep
|
223
|
-
- test/dummy/app/controllers/welcome_controller.rb
|
224
|
-
- test/dummy/app/helpers/application_helper.rb
|
225
|
-
- test/dummy/app/helpers/welcome_helper.rb
|
226
|
-
- test/dummy/app/mailers/.keep
|
227
|
-
- test/dummy/app/models/.keep
|
228
|
-
- test/dummy/app/models/concerns/.keep
|
229
|
-
- test/dummy/app/views/layouts/application.html.erb
|
230
|
-
- test/dummy/bin/bundle
|
231
|
-
- test/dummy/bin/rails
|
232
|
-
- test/dummy/bin/rake
|
233
|
-
- test/dummy/bin/setup
|
234
|
-
- test/dummy/config.ru
|
235
|
-
- test/dummy/config/application.rb
|
236
|
-
- test/dummy/config/boot.rb
|
237
|
-
- test/dummy/config/database.yml
|
238
|
-
- test/dummy/config/environment.rb
|
239
|
-
- test/dummy/config/environments/development.rb
|
240
|
-
- test/dummy/config/environments/production.rb
|
241
|
-
- test/dummy/config/environments/test.rb
|
242
|
-
- test/dummy/config/initializers/assets.rb
|
243
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
244
|
-
- test/dummy/config/initializers/cookies_serializer.rb
|
245
|
-
- test/dummy/config/initializers/filter_parameter_logging.rb
|
246
|
-
- test/dummy/config/initializers/inflections.rb
|
247
|
-
- test/dummy/config/initializers/mime_types.rb
|
248
|
-
- test/dummy/config/initializers/session_store.rb
|
249
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
250
|
-
- test/dummy/config/locales/en.bootstrap.yml
|
251
|
-
- test/dummy/config/locales/en.yml
|
252
|
-
- test/dummy/config/routes.rb
|
253
|
-
- test/dummy/config/secrets.yml
|
254
|
-
- test/dummy/db/development.sqlite3
|
255
|
-
- test/dummy/db/schema.rb
|
256
|
-
- test/dummy/lib/assets/.keep
|
257
|
-
- test/dummy/log/.keep
|
258
|
-
- test/dummy/public/404.html
|
259
|
-
- test/dummy/public/422.html
|
260
|
-
- test/dummy/public/500.html
|
261
|
-
- test/dummy/public/favicon.ico
|
262
|
-
- test/dummy/test/controllers/welcome_controller_test.rb
|
263
|
-
- test/html_format_test.rb
|
264
|
-
- test/test_helper.rb
|
167
|
+
- spec/html_format_spec.rb
|
data/.travis.yml
DELETED
data/test/dummy/README.rdoc
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
== README
|
2
|
-
|
3
|
-
This README would normally document whatever steps are necessary to get the
|
4
|
-
application up and running.
|
5
|
-
|
6
|
-
Things you may want to cover:
|
7
|
-
|
8
|
-
* Ruby version
|
9
|
-
|
10
|
-
* System dependencies
|
11
|
-
|
12
|
-
* Configuration
|
13
|
-
|
14
|
-
* Database creation
|
15
|
-
|
16
|
-
* Database initialization
|
17
|
-
|
18
|
-
* How to run the test suite
|
19
|
-
|
20
|
-
* Services (job queues, cache servers, search engines, etc.)
|
21
|
-
|
22
|
-
* Deployment instructions
|
23
|
-
|
24
|
-
* ...
|
25
|
-
|
26
|
-
|
27
|
-
Please feel free to use a different markup language if you do not plan to run
|
28
|
-
<tt>rake doc:app</tt>.
|
data/test/dummy/Rakefile
DELETED
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
//= require_tree .
|
@@ -1,12 +0,0 @@
|
|
1
|
-
class ApplicationController < ActionController::Base
|
2
|
-
# Prevent CSRF attacks by raising an exception.
|
3
|
-
# For APIs, you may want to use :null_session instead.
|
4
|
-
protect_from_forgery with: :exception
|
5
|
-
|
6
|
-
# helper :html_format
|
7
|
-
# include HtmlFormatHelper
|
8
|
-
# helper HtmlFormat::Application.helpers
|
9
|
-
|
10
|
-
# helper HtmlFormat::HtmlFormatHelper
|
11
|
-
# helper HtmlFormat::Engine.helpers
|
12
|
-
end
|
File without changes
|
@@ -1,46 +0,0 @@
|
|
1
|
-
class WelcomeController < ApplicationController
|
2
|
-
def index
|
3
|
-
body = view_context.instance_eval do
|
4
|
-
[
|
5
|
-
{
|
6
|
-
name: "Array Of Hash",
|
7
|
-
code: <<~EOT,
|
8
|
-
[
|
9
|
-
{id: 1, name: "alice", created_at: "2000-01-01"},
|
10
|
-
{id: 2, name: "bob", created_at: "2000-01-02"},
|
11
|
-
{id: 3, name: "carol", created_at: "2000-01-03"},
|
12
|
-
].to_html
|
13
|
-
EOT
|
14
|
-
},
|
15
|
-
{
|
16
|
-
name: "Hash",
|
17
|
-
code: %({id: 1, name: "alice", created_at: "2000-01-01"}.to_html),
|
18
|
-
},
|
19
|
-
{
|
20
|
-
name: "Array Of Array",
|
21
|
-
code: <<~EOT,
|
22
|
-
[
|
23
|
-
[1, 2, 3],
|
24
|
-
[4, 5, 6],
|
25
|
-
[7, 8, 9],
|
26
|
-
].to_html
|
27
|
-
EOT
|
28
|
-
},
|
29
|
-
{
|
30
|
-
name: "Array",
|
31
|
-
code: %([1, 2, 3].to_html),
|
32
|
-
},
|
33
|
-
].collect { |e|
|
34
|
-
out = []
|
35
|
-
out << content_tag(:div, content_tag(:h2, e[:name]), class: "page-header")
|
36
|
-
out << content_tag(:div, "CODE", class: "label label-info")
|
37
|
-
out << content_tag(:pre, e[:code])
|
38
|
-
out << content_tag(:div, "OUTPUT", class: "label label-info")
|
39
|
-
out << tag(:br)
|
40
|
-
out << content_tag(:div, eval(e[:code]), class: "text-center")
|
41
|
-
}.join.html_safe
|
42
|
-
end
|
43
|
-
|
44
|
-
render html: body, layout: true
|
45
|
-
end
|
46
|
-
end
|
File without changes
|
data/test/dummy/app/models/.keep
DELETED
File without changes
|
File without changes
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>Dummy</title>
|
5
|
-
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
6
|
-
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
7
|
-
<%= csrf_meta_tags %>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
<%= content_tag(:div, class: "container") do %>
|
11
|
-
<%= yield %>
|
12
|
-
<% end %>
|
13
|
-
</body>
|
14
|
-
</html>
|
data/test/dummy/bin/bundle
DELETED
data/test/dummy/bin/rails
DELETED
data/test/dummy/bin/rake
DELETED
data/test/dummy/bin/setup
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'pathname'
|
3
|
-
|
4
|
-
# path to your application root.
|
5
|
-
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
|
-
|
7
|
-
Dir.chdir APP_ROOT do
|
8
|
-
# This script is a starting point to setup your application.
|
9
|
-
# Add necessary setup steps to this file:
|
10
|
-
|
11
|
-
puts "== Installing dependencies =="
|
12
|
-
system "gem install bundler --conservative"
|
13
|
-
system "bundle check || bundle install"
|
14
|
-
|
15
|
-
# puts "\n== Copying sample files =="
|
16
|
-
# unless File.exist?("config/database.yml")
|
17
|
-
# system "cp config/database.yml.sample config/database.yml"
|
18
|
-
# end
|
19
|
-
|
20
|
-
puts "\n== Preparing database =="
|
21
|
-
system "bin/rake db:setup"
|
22
|
-
|
23
|
-
puts "\n== Removing old logs and tempfiles =="
|
24
|
-
system "rm -f log/*"
|
25
|
-
system "rm -rf tmp/cache"
|
26
|
-
|
27
|
-
puts "\n== Restarting application server =="
|
28
|
-
system "touch tmp/restart.txt"
|
29
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require File.expand_path('../boot', __FILE__)
|
2
|
-
|
3
|
-
require 'rails/all'
|
4
|
-
|
5
|
-
Bundler.require(*Rails.groups)
|
6
|
-
require "html_format"
|
7
|
-
|
8
|
-
module Dummy
|
9
|
-
class Application < Rails::Application
|
10
|
-
# Settings in config/environments/* take precedence over those specified here.
|
11
|
-
# Application configuration should go into files in config/initializers
|
12
|
-
# -- all .rb files in that directory are automatically loaded.
|
13
|
-
|
14
|
-
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
15
|
-
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
16
|
-
# config.time_zone = 'Central Time (US & Canada)'
|
17
|
-
|
18
|
-
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
19
|
-
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
20
|
-
# config.i18n.default_locale = :de
|
21
|
-
|
22
|
-
# Do not swallow errors in after_commit/after_rollback callbacks.
|
23
|
-
# config.active_record.raise_in_transactional_callbacks = true
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
data/test/dummy/config/boot.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# SQLite version 3.x
|
2
|
-
# gem install sqlite3
|
3
|
-
#
|
4
|
-
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
-
# gem 'sqlite3'
|
6
|
-
#
|
7
|
-
default: &default
|
8
|
-
adapter: sqlite3
|
9
|
-
pool: 5
|
10
|
-
timeout: 5000
|
11
|
-
|
12
|
-
development:
|
13
|
-
<<: *default
|
14
|
-
database: db/development.sqlite3
|
15
|
-
|
16
|
-
# Warning: The database defined as "test" will be erased and
|
17
|
-
# re-generated from your development database when you run "rake".
|
18
|
-
# Do not set this db to the same as development or production.
|
19
|
-
test:
|
20
|
-
<<: *default
|
21
|
-
database: db/test.sqlite3
|
22
|
-
|
23
|
-
production:
|
24
|
-
<<: *default
|
25
|
-
database: db/production.sqlite3
|