We at JetRockets use Crystal in production since September, 2019.
In these slides I show how Crystal differs from Ruby, how Ruby developers can start using Crystal fast and why we decided to include it in our development stack.
(2 pairs); • you’re chopping an onion, putting it to fry; • while you’re cutting an onion, you’re also chopping a tomato; • you are doing at least two things at the same time;
Plugins.load_plugin(plugin) if plugin.is_a?(Symbol) Plugins.load_dependencies(plugin, self, *args, **kwargs, &block) self.include(plugin::InstanceMethods) if defined?(plugin::InstanceMethods) self.extend(plugin::ClassMethods) if defined?(plugin::ClassMethods) self::UploadedFile.include(plugin::FileMethods) if defined?(plugin::FileMethods) self::UploadedFile.extend(plugin::FileClassMethods) if defined?(plugin::FileClassMethods) self::Attachment.include(plugin::AttachmentMethods) if defined?(plugin::AttachmentMethods) self::Attachment.extend(plugin::AttachmentClassMethods) if defined?(plugin::AttachmentClassMethods) self::Attacher.include(plugin::AttacherMethods) if defined?(plugin::AttacherMethods) self::Attacher.extend(plugin::AttacherClassMethods) if defined?(plugin::AttacherClassMethods) Plugins.configure(plugin, self, *args, **kwargs, &block) plugin end
%} {% PLUGINS << {decl: plugin, options: options} %} {% if plugin.constant(:InstanceMethods) %} include {{plugin.constant(:InstanceMethods)}} {% end %} {% if plugin.constant(:ClassMethods) %} extend {{plugin.constant(:ClassMethods)}} {% end %} end
plugin.constant(:FileClassMethods) %} class UploadedFile < Shrine::UploadedFile extend {{plugin.constant(:FileClassMethods)}} end {% end %} {% if plugin.constant(:FileMethods) %} class UploadedFile < Shrine::UploadedFile include {{plugin.constant(:FileMethods)}} end {% end %} end
library (yes, I’ve never used minitest) • One code formatting rules (I recently discovered Rufo) • One deployment tool (who ever used Mina?) • One web framework :(
ability to make your OpenSource commitment; • we maintain Shrine.cr; • https://github.com/jetrockets/shrine.cr • https://jetrockets.github.io/shrine.cr
specific `format` # (defaults to `:html`) # # == Parameters: # format:: # A Symbol declaring the format to convert the object to. This # can be `:text` or `:html`. # # == Returns: # A string representing the object in a specified # format. # def to_format(format = :html) # format the object end
--gen-config`on 2020-02-23 13:02:10 UTC using # Ameba version 0.11.0. # The point is for the user to remove these configuration # records one by one as the reported problems are removed # from the code base. # Problems found: 1 # Run `ameba --only Lint/ShadowingOuterLocalVar` for details Lint/ShadowingOuterLocalVar: Description: Disallows the usage of the same name as outer local variables for block or proc arguments. Enabled: true Severity: Warning Excluded: - spec/lib/uploaded_file_spec.cr