magicfile 0.0.2 → 0.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/magicfile.rb +0 -20
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02016d64cbb56cd1baafde41f62f3b071719a840
|
4
|
+
data.tar.gz: 952890ee6da3036fb6d1961930e49f4b63ed168c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af73cbf801522272d9c9af32125d4b956b20c4d6814a0cee4ffbc54b08575c05afe72f8366b1c66e0f28fec2ebb7dc049cb5e90d34cfba414a072f381d7f498d
|
7
|
+
data.tar.gz: 48e9c8cf6b63dd31c5bd8ebb7daed9a8d6870097cfe9def933656ca8eb24d338c3dc3590dae002ec117171a8118192c73f78ca26dd855532ee80f43394128ddf
|
data/lib/magicfile.rb
CHANGED
@@ -48,7 +48,6 @@ class Magicfile
|
|
48
48
|
def append_string_lines(line_contents)
|
49
49
|
space_num = @current_line_space_num + 2
|
50
50
|
content = line_contents.join("\n" + " " * space_num)
|
51
|
-
ap content
|
52
51
|
line = MagicLine.new(content, space_num)
|
53
52
|
@lines.insert(@current_line_index + 1, line)
|
54
53
|
end
|
@@ -65,30 +64,11 @@ class Magicfile
|
|
65
64
|
@current_line_index += 1
|
66
65
|
end
|
67
66
|
|
68
|
-
ap "after start======"
|
69
|
-
ap @lines
|
70
|
-
ap @current_line_index
|
71
|
-
ap @current_line_space_num
|
72
|
-
ap "end======"
|
73
|
-
|
74
67
|
end
|
75
68
|
|
76
69
|
def to_file(name)
|
77
70
|
infos = @lines.map { |line| " " * line.instance_variable_get("@space_num") + line.instance_variable_get("@content") }
|
78
|
-
ap infos.join("\n")
|
79
71
|
File.open(name, 'w') { |file| file.write(infos.join("\n")) }
|
80
72
|
end
|
81
73
|
|
82
|
-
def display
|
83
|
-
@lines.each do |line|
|
84
|
-
ap ' ' * line.instance_variable_get("@space_num") + line.instance_variable_get("@content")
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
74
|
end
|
89
|
-
|
90
|
-
a = Magicfile.new
|
91
|
-
a.append_modules(['api', 'v1', 'entities'])
|
92
|
-
a.append_class('screen', 'Grape::Entity')
|
93
|
-
a.append_string_lines(['expose :id', 'expose :name'])
|
94
|
-
a.to_file('tmp.txt')
|