Class: RbsMiniMagick::Flows::Major5Minor0::ImageClass

Inherits:
Object
  • Object
show all
Defined in:
lib/rbs_mini_magick/flows/major5_minor0/image_class.rb

Overview

RbsMiniMagick::Flows::Major5Minor0::ImageClass

Instance Method Summary collapse

Instance Method Details

#run(state) ⇒ RbsMiniMagick::Flows::State



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/rbs_mini_magick/flows/major5_minor0/image_class.rb', line 11

def run(state) # rubocop:disable Metrics/MethodLength
  image_instance_methods = MiniMagick::Image.instance_methods.to_set(&:to_s)
  mogrify_methods = state.fetch_tool_usage("mogrify")
                         .options
                         .reject { image_instance_methods.include?(_1.normalized_name) }
                         .map { mogrify_method(_1) }
                         .uniq.join("\n")
  rbs = "    module MiniMagick\n      class Image\n        def initialize: (_ToS input_path, ?Tempfile? tempfile) ?{ (Tool & _Mogrify) -> void } -> void\n                      | ...\n\n        def combine_options: () { (Tool & _Mogrify) -> void } -> self\n                           | ...\n\n        def composite: (instance other_image, ?String output_extension, ?untyped? mask) ?{ (Tool & _Composite) -> void } -> instance\n                     | ...\n\n        def identify: () ?{ (Tool & _Identify) -> void } -> String\n                    | ...\n\n        def mogrify: (?Integer? page) ?{ (Tool & _Mogrify) -> void } -> self\n                   | ...\n\n        \#{mogrify_methods}\n      end\n    end\n  RBS\n\n  state.concat_rbs(rbs)\nend\n"