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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/get_indent.rb +9 -2
  3. metadata +1 -2
  4. data/lib/indent.rb +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 34fcf20e588aa1579b84b39929a80b3c4f477534
4
- data.tar.gz: e011371f30203c264c4e80f6578c472159d1ca27
3
+ metadata.gz: 9fec1c7a247c4c795f92b2ce9dff8e58af602c5a
4
+ data.tar.gz: 4462d2febf723123a0385f87c7315de95f1ceec0
5
5
  SHA512:
6
- metadata.gz: c02eaa6528975b5522c25f615ba0eb0f4b1bb973880bd468e4a668f3ffcb15d748b8da15ae301f0163faf4dd61bb3a5ea8f064ec7cc804ce53e38d33d1ffcea1
7
- data.tar.gz: abd602c3aebaebf534c293926d9a9498f1b14d469bfb896c08c35e6a975925a7f75037907de4a718bd273ca84ba6dba23d139d455643bef3746255d41734155e
6
+ metadata.gz: 3b974186bce94dfef8f722a41f7fd2cead52bc69c13046dfc1d18287be26ed34d2592ed036f4f2650eb89a8bf1b89d135b551e5a845a6142f883b00bb848d7e3
7
+ data.tar.gz: 6795274d903a4cf30fbdc61e629bababb265ecd344ef2e624c36adc29d17687ebc82f3ed4b835f3e5cdf0f6add7539d00e7a48f984735dc45a54041709477fb4
data/lib/get_indent.rb CHANGED
@@ -1,5 +1,5 @@
1
- def __indent__
2
- caller = caller_locations(1,1)[0]
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.2
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