printrun 0.0.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.
- checksums.yaml +15 -0
- data/README.md +4 -0
- data/lib/printrun/core.rb +25 -0
- data/lib/printrun/version.rb +3 -0
- data/lib/printrun.rb +22 -0
- metadata +62 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YjM3YjI5MTVhZGI1ZGI1NjMyMzQ0OTJkNjkyMmE0Y2VmMzExNTQ0MQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZDE0NGQ4ZDk3NzBlZmQwZTcxZjU2ZWUzZDU2ODVmZWQwNDgyZDI4Yw==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YWQxYjFjZDdiNjQ3MDI1ZjYyNmI4NzY3ZDQ3MGJlMGFlMzgwZTBiZjczM2Ew
|
10
|
+
ZWM4Y2JmNDRkZTk5OWEwYzZkZTM4NDU1M2U4ZmM0MzVkMzIyMTFlNWE0YmZi
|
11
|
+
YzM5MjJhYjdhYzIzNmNmODAyZWE0ZDI0MzM1YjcyZTc1ODIyNGI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZjA3OTQ3YjNiZWYyMzZkMjM2NTljNzY2ODU1YTRlNzhhOGVmNDE1ZTMyNDcz
|
14
|
+
YTU4ODA2NTMxYjc4MWZmNDI5M2VjNGYwYTQyM2E0YWQ1MjFlYTIzNGVmMGY2
|
15
|
+
OWE5NzFmNGFiZTlhNTlhZjM2MmFlOWVhOWVhMzdiZjQwNjk3NTM=
|
data/README.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'ripper'
|
2
|
+
require 'sourcify'
|
3
|
+
|
4
|
+
module Printrun
|
5
|
+
module Core
|
6
|
+
|
7
|
+
def lines(source)
|
8
|
+
Enumerator.new do |out|
|
9
|
+
source.split("\n")[1..-2].reduce("") do |buffer, line|
|
10
|
+
buffer << "\n#{line}"
|
11
|
+
Ripper.sexp_raw(buffer) ? (out << buffer) && "" : buffer
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# @param [Binding] world Binding to use for evaluation of statements
|
17
|
+
# @param [Proc] line2ansp Proc that takes the line to process as parameter and returns
|
18
|
+
# a Proc taking the result of previous line's evaluation as parameter
|
19
|
+
# @yield [block] Block of code to process (line-eval~~~).
|
20
|
+
def line_eval(world, line2ansp, &block)
|
21
|
+
lines(block.to_source).each { |line| line2ansp[line][eval(line, world)] }
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
data/lib/printrun.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'printrun/core'
|
2
|
+
|
3
|
+
module Printrun
|
4
|
+
include Core
|
5
|
+
extend self
|
6
|
+
|
7
|
+
# careful of the bug of sourcify with double quotes (if still there at time of reading)...
|
8
|
+
# @example
|
9
|
+
# Printrun.on do
|
10
|
+
# a = 3
|
11
|
+
# puts a
|
12
|
+
# end
|
13
|
+
def on(world = proc { binding }[], &block)
|
14
|
+
i = 0
|
15
|
+
line_eval(world,
|
16
|
+
proc { |line|
|
17
|
+
puts "#{i += 1} >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#{line}\n --- "
|
18
|
+
proc { |ans| puts "#{ans}\ndone!" }
|
19
|
+
}, &block)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
metadata
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: printrun
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Johan Gall
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-04-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sourcify
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Quick and dirty print and run of ruby code because I was tired of copying
|
28
|
+
my gist
|
29
|
+
email: johan.gall+github_printrun@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- lib/printrun/core.rb
|
35
|
+
- lib/printrun/version.rb
|
36
|
+
- lib/printrun.rb
|
37
|
+
- README.md
|
38
|
+
homepage: https://github.com/freakhill/printrun
|
39
|
+
licenses: []
|
40
|
+
metadata: {}
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options: []
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 1.9.1
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.3.6
|
55
|
+
requirements: []
|
56
|
+
rubyforge_project:
|
57
|
+
rubygems_version: 2.0.3
|
58
|
+
signing_key:
|
59
|
+
specification_version: 4
|
60
|
+
summary: Print and execute ruby code
|
61
|
+
test_files: []
|
62
|
+
has_rdoc:
|