File tree Expand file tree Collapse file tree 3 files changed +34
-21
lines changed
templates/ruby/lib/container Expand file tree Collapse file tree 3 files changed +34
-21
lines changed Original file line number Diff line number Diff line change @@ -147,8 +147,8 @@ public function getFiles()
147
147
],
148
148
[
149
149
'scope ' => 'default ' ,
150
- 'destination ' => 'lib/{{ spec.title | caseDash }}/file .rb ' ,
151
- 'template ' => 'ruby/lib/container/file .rb.twig ' ,
150
+ 'destination ' => 'lib/{{ spec.title | caseDash }}/input_file .rb ' ,
151
+ 'template ' => 'ruby/lib/container/input_file .rb.twig ' ,
152
152
'minify ' => false ,
153
153
],
154
154
[
@@ -281,7 +281,7 @@ public function getParamExample(array $param)
281
281
$ output .= '{} ' ;
282
282
break ;
283
283
case self ::TYPE_FILE :
284
- $ output .= "'dir/file.png' " ;
284
+ $ output .= "InputFile.fromPath( 'dir/file.png') " ;
285
285
break ;
286
286
}
287
287
}
@@ -302,7 +302,7 @@ public function getParamExample(array $param)
302
302
$ output .= "' {$ example }' " ;
303
303
break ;
304
304
case self ::TYPE_FILE :
305
- $ output .= "' file.png' " ;
305
+ $ output .= "InputFile.fromPath('dir/ file.png') " ;
306
306
break ;
307
307
}
308
308
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ require 'mime/types'
2
+
3
+ module {{spec .title | caseUcfirst }}
4
+ class InputFile
5
+ attr_accessor :path
6
+ attr_accessor :filename
7
+ attr_accessor :mime_type
8
+ attr_accessor :source_type
9
+
10
+ attr_accessor :data
11
+
12
+ def self.fromPath(path)
13
+ instance = InputFile.new
14
+ instance.path = path
15
+ instance.filename = ::File.basename(path)
16
+ instance.mime_type = MIME::Types.type_for(path)
17
+ instance.source_type = 'path'
18
+ instance
19
+ end
20
+
21
+ def self.fromBytes(bytes, filename: nil, mime_type: nil)
22
+ instance = InputFile.new
23
+ instance.data = bytes
24
+ instance.filename = filename
25
+ instance.mime_type = mime_type
26
+ instance.source_type = 'bytes'
27
+ instance
28
+ end
29
+ end
30
+ end
You can’t perform that action at this time.
0 commit comments