get_indent 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/get_indent.rb +9 -2
- metadata +1 -2
- data/lib/indent.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fec1c7a247c4c795f92b2ce9dff8e58af602c5a
|
4
|
+
data.tar.gz: 4462d2febf723123a0385f87c7315de95f1ceec0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b974186bce94dfef8f722a41f7fd2cead52bc69c13046dfc1d18287be26ed34d2592ed036f4f2650eb89a8bf1b89d135b551e5a845a6142f883b00bb848d7e3
|
7
|
+
data.tar.gz: 6795274d903a4cf30fbdc61e629bababb265ecd344ef2e624c36adc29d17687ebc82f3ed4b835f3e5cdf0f6add7539d00e7a48f984735dc45a54041709477fb4
|
data/lib/get_indent.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
def
|
2
|
-
caller = caller_locations(1,1)[
|
1
|
+
def __get_indent n
|
2
|
+
caller = caller_locations(1,1)[n]
|
3
3
|
line = IO.readlines(caller.absolute_path)[caller.lineno-1]
|
4
4
|
|
5
5
|
cnt = 0
|
@@ -7,4 +7,11 @@ def __indent__
|
|
7
7
|
return cnt / 2 if c != ' '
|
8
8
|
cnt += 1
|
9
9
|
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def __indent__
|
13
|
+
__get_indent 0
|
14
|
+
end
|
15
|
+
def __indent_of_caller__
|
16
|
+
__get_indent 1
|
10
17
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: get_indent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pjc0247
|
@@ -18,7 +18,6 @@ extensions: []
|
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
20
|
- lib/get_indent.rb
|
21
|
-
- lib/indent.rb
|
22
21
|
homepage: http://github.com/pjc0247/indent
|
23
22
|
licenses: []
|
24
23
|
metadata: {}
|
data/lib/indent.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
def __get_indent n
|
2
|
-
caller = caller_locations(1,1)[n]
|
3
|
-
line = IO.readlines(caller.absolute_path)[caller.lineno-1]
|
4
|
-
|
5
|
-
cnt = 0
|
6
|
-
line.each_char do |c|
|
7
|
-
return cnt / 2 if c != ' '
|
8
|
-
cnt += 1
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
def __indent__
|
13
|
-
__get_indent 0
|
14
|
-
end
|
15
|
-
def __indent_of_caller__
|
16
|
-
__get_indent 1
|
17
|
-
end
|