Sha256: 26ef2f5736cdad1af3de2ac3261622edc5d8b87bb138bf20c6da0da216ae3226

Contents?: true

Size: 1.63 KB

Versions: 25

Compression:

Stored size: 1.63 KB

Contents

module HybridPlatformsConductor

  module HpcPlugins

    module PlatformHandler

      class ServerlessChef < HybridPlatformsConductor::PlatformHandler

        # Small class that can get a Ruby DSL file and return all DSL calls that have been made to it
        class DslParser

          # List of calls made by parsing the source file
          # Array
          attr_reader :calls

          # Constructor
          #
          # Parameters::
          # * *calls* (Array): List of calls to complement [default = []]
          def initialize(calls = [])
            @calls = calls
          end

          # Parse a file and get all its DSL calls
          #
          # Parameters::
          # * *source* (String): File to parse
          def parse(source)
            instance_eval(File.read(source))
          end

          # Intercept all missing methods
          #
          # Parameters::
          # * *method_name* (Symbol): The missing method being called
          def method_missing(method_name, *args, &block)
            sub_calls = []
            @calls << {
              method: method_name,
              args: args,
              block: block,
              calls_on_result: sub_calls
            }
            DslParser.new(sub_calls)
          end

          # Make sure we register the methods we handle in method_missing
          #
          # Parameters::
          # * *name* (Symbol): The missing method name
          # * *include_private* (Boolean): Should we include private methods in the search?
          def respond_to_missing?(_name, _include_private)
            true
          end

        end

      end

    end

  end

end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
hybrid_platforms_conductor-33.8.3 lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/dsl_parser.rb
hybrid_platforms_conductor-33.8.2 lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/dsl_parser.rb
hybrid_platforms_conductor-33.8.1 lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/dsl_parser.rb
hybrid_platforms_conductor-33.8.0 lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/dsl_parser.rb
hybrid_platforms_conductor-33.7.4 lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/dsl_parser.rb
hybrid_platforms_conductor-33.7.3 lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/dsl_parser.rb
hybrid_platforms_conductor-33.7.2 lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/dsl_parser.rb
hybrid_platforms_conductor-33.7.1 lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/dsl_parser.rb
hybrid_platforms_conductor-33.7.0 lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/dsl_parser.rb
hybrid_platforms_conductor-33.6.0 lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/dsl_parser.rb
hybrid_platforms_conductor-33.5.1 lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/dsl_parser.rb
hybrid_platforms_conductor-33.5.0 lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/dsl_parser.rb
hybrid_platforms_conductor-33.4.0 lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/dsl_parser.rb
hybrid_platforms_conductor-33.3.0 lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/dsl_parser.rb
hybrid_platforms_conductor-33.2.4 lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/dsl_parser.rb
hybrid_platforms_conductor-33.2.3 lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/dsl_parser.rb
hybrid_platforms_conductor-33.2.2 lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/dsl_parser.rb
hybrid_platforms_conductor-33.2.1 lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/dsl_parser.rb
hybrid_platforms_conductor-33.2.0 lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/dsl_parser.rb
hybrid_platforms_conductor-33.1.1 lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/dsl_parser.rb