Sha256: 06db352fe2590092f2f7ee545cef0bb81380970d1380010f6f9232e3ffd4405d

Contents?: true

Size: 605 Bytes

Versions: 7

Compression:

Stored size: 605 Bytes

Contents

module Expressir
  module Model
    module Scope
      attr_accessor :source

      def find(path)
        current, rest = path.downcase.split(".", 2)

        # ignore `wr:`, `ip:` part
        if current.include? ":"
          _, current = current.split(":", 2)
        end

        child = children.find{|x| x.id.downcase == current}

        if rest
          if child.class.method_defined? :find
            child.find(rest)
          else
            nil
          end
        else
          child
        end
      end

      def children
        raise 'Not implemented'
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
expressir-0.2.8 lib/expressir/model/scope.rb
expressir-0.2.8-x86_64-linux lib/expressir/model/scope.rb
expressir-0.2.8-x86_64-darwin lib/expressir/model/scope.rb
expressir-0.2.8-x86-mingw32 lib/expressir/model/scope.rb
expressir-0.2.8-x86-linux lib/expressir/model/scope.rb
expressir-0.2.8-x64-mingw32 lib/expressir/model/scope.rb
expressir-0.2.8-arm64-darwin lib/expressir/model/scope.rb