get_indent 1.0.1 → 1.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/lib/indent.rb +17 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34fcf20e588aa1579b84b39929a80b3c4f477534
|
4
|
+
data.tar.gz: e011371f30203c264c4e80f6578c472159d1ca27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c02eaa6528975b5522c25f615ba0eb0f4b1bb973880bd468e4a668f3ffcb15d748b8da15ae301f0163faf4dd61bb3a5ea8f064ec7cc804ce53e38d33d1ffcea1
|
7
|
+
data.tar.gz: abd602c3aebaebf534c293926d9a9498f1b14d469bfb896c08c35e6a975925a7f75037907de4a718bd273ca84ba6dba23d139d455643bef3746255d41734155e
|
data/lib/indent.rb
ADDED
@@ -0,0 +1,17 @@
|
|
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
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pjc0247
|
@@ -18,6 +18,7 @@ extensions: []
|
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
20
|
- lib/get_indent.rb
|
21
|
+
- lib/indent.rb
|
21
22
|
homepage: http://github.com/pjc0247/indent
|
22
23
|
licenses: []
|
23
24
|
metadata: {}
|