Module: TilesetTooling::Utils
- Defined in:
- lib/tileset_tooling/utils.rb
Overview
A few random utilities
Class Method Summary collapse
-
.image_signature(image_path) ⇒ Object
Generate a signature from the image data.
-
.image_spec_file_path(image_path) ⇒ Object
Gets the path to the spec file that should go with the given image.
Class Method Details
.image_signature(image_path) ⇒ Object
Generate a signature from the image data
11 12 13 14 15 16 17 |
# File 'lib/tileset_tooling/utils.rb', line 11 def image_signature(image_path) ::MiniMagick::Tool::Identify.new do |identity| identity.quiet identity.format('%#\\n') identity << image_path end end |
.image_spec_file_path(image_path) ⇒ Object
Gets the path to the spec file that should go with the given image
20 21 22 23 24 25 |
# File 'lib/tileset_tooling/utils.rb', line 20 def image_spec_file_path(image_path) file_name = ::File.basename(image_path, '.*') directory = ::File.dirname(image_path) "#{directory}/#{file_name}.specs" end |