### Home Classes Methods

### In Files

- lib/gherkin/native/ikvm.rb
- lib/gherkin/native/null.rb
- lib/gherkin/native/java.rb

### Parent

Object

### Methods

- ::===
- ::ikvm_class
- ::ikvmify
- ::java_class
- ::javaify
- ::new
- #implements
- #native_impl

### Files

- LICENSE
- README.rdoc
- meta.txt
- root.txt
- steps.txt
- README.rdoc

### Class/Module Index

Quicksearch

- Gherkin
- Gherkin::CLexer
- Gherkin::Cli
- Gherkin::Cli::Main
- Gherkin::Formatter
- Gherkin::Formatter::Argument
- Gherkin::Formatter::Colors
- Gherkin::Formatter::Escaping
- Gherkin::Formatter::JSONFormatter
- Gherkin::Formatter::MonochromeFormat
- Gherkin::Formatter::PrettyFormatter
- Gherkin::I18n
- Gherkin::I18nLexer
- Gherkin::JSONLexer
- Gherkin::Parser
- Gherkin::Parser::Event
- Gherkin::Parser::FilterListener
- Gherkin::Parser::FormatterListener
- Gherkin::Parser::ParseError
- Gherkin::Parser::Parser
- Gherkin::Parser::Parser::Machine
- Gherkin::Parser::Parser::Machine::StateMachineReader
- Gherkin::Parser::Row
- Gherkin::Parser::TagExpression
- Gherkin::RbLexer
- Gherkin::Rubify
- Gherkin::Tools
- Gherkin::Tools::Files
- Gherkin::Tools::Reformat
- Gherkin::Tools::Stats
- Gherkin::Tools::StatsListener
- Class

No matching classes.

# Class

### Public Class Methods

===(object) click to toggle source

    # File lib/gherkin/native/ikvm.rb, line 40
    def ===(object)
      super || object.java_kind_of?(java_class)
    end

ikvm_class() click to toggle source

    # File lib/gherkin/native/ikvm.rb, line 44
    def ikvm_class
      names = self.name.split('::')
      namespace = Object
      names[0..-2].each do |module_name|
        namespace = namespace.const_get(module_name.downcase)
      end

      namespace.const_get(names[-1])
    end

ikvmify(arg) click to toggle source

    # File lib/gherkin/native/ikvm.rb, line 23
    def ikvmify(arg)
      if Array === arg
        arg.map{|a| ikvmify(a)}
      else
        case(arg)
        when Regexp
          Object.const_get('java').const_get('util').const_get('regex').const_get('Pattern').compile(arg.source)
        else
          arg
        end
      end
    end

java_class() click to toggle source

    # File lib/gherkin/native/java.rb, line 36
    def java_class
      names = self.name.split('::')
      package = Java
      names[0..-2].each do |module_name|
        package = package.__send__(module_name.downcase)
      end

      package.__send__(names[-1])
    end

javaify(arg) click to toggle source

    # File lib/gherkin/native/java.rb, line 15
    def javaify(arg)
      if Array === arg
        arg.map{|a| javaify(a)}
      else
        case(arg)
        when Regexp
          java.util.regex.Pattern.compile(arg.source)
        else
          arg
        end
      end
    end

new(*args) click to toggle source

    # File lib/gherkin/native/ikvm.rb, line 36
    def new(*args)
      ikvm_class.new(*ikvmify(args))
    end

### Public Instance Methods

implements(java_class_name) click to toggle source

    # File lib/gherkin/native/ikvm.rb, line 3
    def implements(java_class_name)
      m = java_class_name.split('.').inject(Object) do |mod, name|
        mod = mod.const_get(name)
      end
      include m
    end

native_impl(lib) click to toggle source

Causes a .NET class to be instantiated instead of the Ruby class when running on IronRuby. This is used to test both pure .NET and pure Ruby classes from the same Ruby based test suite. The .NET Class must have a package name that corresponds with the Ruby class.

    # File lib/gherkin/native/ikvm.rb, line 14
    def native_impl(lib)
      begin
        load_assembly(lib)
      rescue LoadError => e
        e.message << "\nTry this: SET MONO_PATH=#{File.expand_path(File.dirname(__FILE__) + '/../..')} (or export MONO_PATH=...)"
        raise e
      end

      class << self
        def ikvmify(arg)
          if Array === arg
            arg.map{|a| ikvmify(a)}
          else
            case(arg)
            when Regexp
              Object.const_get('java').const_get('util').const_get('regex').const_get('Pattern').compile(arg.source)
            else
              arg
            end
          end
        end

        def new(*args)
          ikvm_class.new(*ikvmify(args))
        end

        def ===(object)
          super || object.java_kind_of?(java_class)
        end

        def ikvm_class
          names = self.name.split('::')
          namespace = Object
          names[0..-2].each do |module_name|
            namespace = namespace.const_get(module_name.downcase)
          end

          namespace.const_get(names[-1])
        end
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.