pythonism 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +44 -33
- data/lib/pythonism/pythonize/statement.rb +16 -2
- data/lib/pythonism/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -3,7 +3,14 @@ Pythonism gem
|
|
3
3
|
|
4
4
|
Ruby for my dear Pythonistas...
|
5
5
|
|
6
|
-
|
6
|
+
Requirement
|
7
|
+
-----------
|
8
|
+
|
9
|
+
* **Ruby** 1.9+
|
10
|
+
* **Knowledge** of Python
|
11
|
+
|
12
|
+
Installation
|
13
|
+
------------
|
7
14
|
|
8
15
|
Add this line to your application's Gemfile:
|
9
16
|
|
@@ -17,38 +24,42 @@ Or install it yourself as:
|
|
17
24
|
|
18
25
|
$ gem install pythonism
|
19
26
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
irb(main):
|
27
|
-
The Zen of Python, by Tim Peters
|
28
|
-
|
29
|
-
Beautiful is better than ugly.
|
30
|
-
Explicit is better than implicit.
|
31
|
-
Simple is better than complex.
|
32
|
-
Complex is better than complicated.
|
33
|
-
Flat is better than nested.
|
34
|
-
Sparse is better than dense.
|
35
|
-
Readability counts.
|
36
|
-
Special cases aren't special enough to break the rules.
|
37
|
-
Although practicality beats purity.
|
38
|
-
Errors should never pass silently.
|
39
|
-
Unless explicitly silenced.
|
40
|
-
In the face of ambiguity, refuse the temptation to guess.
|
41
|
-
There should be one-- and preferably only one --obvious way to do it.
|
42
|
-
Although that way may not be obvious at first unless you're Dutch.
|
43
|
-
Now is better than never.
|
44
|
-
Although never is often better than *right* now.
|
45
|
-
If the implementation is hard to explain, it's a bad idea.
|
46
|
-
If the implementation is easy to explain, it may be a good idea.
|
47
|
-
Namespaces are one honking great idea -- let's do more of those!
|
48
|
-
=>
|
49
|
-
|
50
|
-
|
51
|
-
|
27
|
+
Usage
|
28
|
+
-----
|
29
|
+
|
30
|
+
### Zen
|
31
|
+
|
32
|
+
megurine % irb -r pythonism
|
33
|
+
irb(main):001:0> import this
|
34
|
+
The Zen of Python, by Tim Peters
|
35
|
+
|
36
|
+
Beautiful is better than ugly.
|
37
|
+
Explicit is better than implicit.
|
38
|
+
Simple is better than complex.
|
39
|
+
Complex is better than complicated.
|
40
|
+
Flat is better than nested.
|
41
|
+
Sparse is better than dense.
|
42
|
+
Readability counts.
|
43
|
+
Special cases aren't special enough to break the rules.
|
44
|
+
Although practicality beats purity.
|
45
|
+
Errors should never pass silently.
|
46
|
+
Unless explicitly silenced.
|
47
|
+
In the face of ambiguity, refuse the temptation to guess.
|
48
|
+
There should be one-- and preferably only one --obvious way to do it.
|
49
|
+
Although that way may not be obvious at first unless you're Dutch.
|
50
|
+
Now is better than never.
|
51
|
+
Although never is often better than *right* now.
|
52
|
+
If the implementation is hard to explain, it's a bad idea.
|
53
|
+
If the implementation is easy to explain, it may be a good idea.
|
54
|
+
Namespaces are one honking great idea -- let's do more of those!
|
55
|
+
=> None
|
56
|
+
|
57
|
+
Thus, Soul and Zen of Python dwelled in Ruby.
|
58
|
+
|
59
|
+
###
|
60
|
+
|
61
|
+
Contributing
|
62
|
+
------------
|
52
63
|
|
53
64
|
1. Fork it
|
54
65
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
@@ -1,7 +1,10 @@
|
|
1
|
+
# Support Python-like statement
|
1
2
|
module Pythonism::Pythonize::Statement
|
3
|
+
# method of imitation +import+ statement
|
4
|
+
# @return [Boolean]
|
2
5
|
def import (obj)
|
3
|
-
case obj
|
4
|
-
when
|
6
|
+
case obj
|
7
|
+
when :this
|
5
8
|
puts <<EOT
|
6
9
|
The Zen of Python, by Tim Peters
|
7
10
|
|
@@ -30,4 +33,15 @@ EOT
|
|
30
33
|
require obj.to_s
|
31
34
|
end
|
32
35
|
end
|
36
|
+
|
37
|
+
# special keyword for Zen
|
38
|
+
# @return [Symbol]
|
39
|
+
def this
|
40
|
+
case self.inspect
|
41
|
+
when 'main'
|
42
|
+
:this
|
43
|
+
else
|
44
|
+
raise NameError, "name 'this' is not defined"
|
45
|
+
end
|
46
|
+
end
|
33
47
|
end
|
data/lib/pythonism/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pythonism
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-15 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: This gem was made for friendship with Pythonistas.
|
15
15
|
email:
|