captains_log 0.0.1 → 0.0.2
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/README.rdoc +34 -2
- data/lib/captains_log/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: e428ffbb92c4c5d10c34f0812a48fdcdd54972f7
|
4
|
+
data.tar.gz: db96b934a469f481aa6a442d05ade858be13fb8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 758e3caec0568f04089bb3e1516395a818e9a14409ece0fd56ec0371b6bbd879c1be9b6e38f5f95f39a1d858494d81f7500e602320b024d86490a3a52b35333f
|
7
|
+
data.tar.gz: 772b6f45bf3247a72b1b53c9b1c4e911dd680836ed21311861bbd38a1ae7e27429a1277822325e71af4293df72f3269d8b2ea61aecb673b1bba9ba5f32726310
|
data/README.rdoc
CHANGED
@@ -1,3 +1,35 @@
|
|
1
|
-
=
|
1
|
+
{<img src="https://badge.fury.io/rb/captains_log.svg" alt="Gem Version" />}[http://badge.fury.io/rb/captains_log]
|
2
2
|
|
3
|
-
|
3
|
+
= Captain's Log
|
4
|
+
|
5
|
+
WARNING: Captains Log will scan any given text for code to evaluate. It is highly recommended that you do not use this against user-input. For your application's security, please only use Captain's Log against input from trusted administrators.
|
6
|
+
|
7
|
+
This project rocks and uses MIT-LICENSE.
|
8
|
+
|
9
|
+
== Installation
|
10
|
+
|
11
|
+
1. Add Captains Log to your application's Gemfile
|
12
|
+
|
13
|
+
gem 'captains_log', '0.0.1'
|
14
|
+
|
15
|
+
Note: It is recommended that you provide the version number as breaking changes may be released with minor version bumps.
|
16
|
+
|
17
|
+
== Usage
|
18
|
+
|
19
|
+
Captain's Log evaluates lines of Ruby embedded in larger bodies of texts, such as blog entries. As a programmer, it enables me to demonstrate functional code from blog posts stored in my database. In order to recognise these blocks of code, we use a made-up HTML tag: `<eval>[code to execute]</eval>`.
|
20
|
+
|
21
|
+
In your body of text, ensure that code blocks to be evaluated are concatenated onto one line and surrounded by the `eval` tag.
|
22
|
+
|
23
|
+
To have Captain's Log evaluate these code blocks in your texts, use the `captains_log` helper:
|
24
|
+
|
25
|
+
<%= captains_log(@blog_post.body) %>
|
26
|
+
|
27
|
+
If `captains_log` isn't to your tastes, you can of course surround the helper in an alternative helper of your own. On my site, I use `badass_digest`:
|
28
|
+
|
29
|
+
def badass_digest(content)
|
30
|
+
captains_log(content)
|
31
|
+
end
|
32
|
+
|
33
|
+
Using your own alternative is then as easy as utilising the original:
|
34
|
+
|
35
|
+
<%= badass_digest(@blog_post.body) %>
|
data/lib/captains_log/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: captains_log
|
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
|
- Thom Bruce
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|