Class: Keys::Swift::Writer
- Inherits:
-
Object
- Object
- Keys::Swift::Writer
- Defined in:
- lib/core/utils/swift/writer.rb
Instance Method Summary collapse
-
#initialize(mapped_keys:, secure_key_bytes:) ⇒ Writer
constructor
Initialize the writer with the mapped keys and the secure key bytes.
-
#write ⇒ Object
Write the keys to the file.
Constructor Details
#initialize(mapped_keys:, secure_key_bytes:) ⇒ Writer
Initialize the writer with the mapped keys and the secure key bytes
18 19 20 21 22 23 |
# File 'lib/core/utils/swift/writer.rb', line 18 def initialize(mapped_keys:, secure_key_bytes:) self.mapped_keys = mapped_keys self.secure_key_bytes = secure_key_bytes self.key_file = "#{SWIFT_PACKAGE_NAME}.swift" self.key_directory = "#{SWIFT_PACKAGE_DIRECTORY}/Sources/#{SWIFT_PACKAGE_NAME}" end |
Instance Method Details
#write ⇒ Object
Write the keys to the file
26 27 28 29 30 31 |
# File 'lib/core/utils/swift/writer.rb', line 26 def write # Write the file File.open("#{key_directory}/#{key_file}", 'w') do |file| file.write(key_swift_file_template(content: formatted_keys)) end end |