Module: PipeOperator

Defined in:
lib/pipe_operator.rb,
lib/pipe_operator/pipe.rb,
lib/pipe_operator/proxy.rb,
lib/pipe_operator/closure.rb,
lib/pipe_operator/observer.rb,
lib/pipe_operator/proxy_resolver.rb

Defined Under Namespace

Modules: Observer Classes: Closure, Pipe, Proxy, ProxyResolver

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.gemObject



18
19
20
# File 'lib/pipe_operator.rb', line 18

def gem
  @gem ||= ::Gem::Specification.load("#{root}/pipe_operator.gemspec")
end

.inspect(object) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/pipe_operator.rb', line 22

def inspect(object)
  object.inspect
rescue ::NoMethodError
  singleton = singleton(object)
  name = singleton.name || singleton.superclass.name
  id = "0x0000%x" % (object.__id__ << 1)
  "#<#{name}:#{id}>"
end

.rootObject



31
32
33
# File 'lib/pipe_operator.rb', line 31

def root
  @root ||= ::Pathname.new(__dir__).join("..")
end

.singleton(object) ⇒ Object



35
36
37
38
39
# File 'lib/pipe_operator.rb', line 35

def singleton(object)
  (class << object; self end)
rescue ::TypeError
  object.class
end

.versionObject



41
42
43
# File 'lib/pipe_operator.rb', line 41

def version
  @version ||= gem.version.to_s
end

Instance Method Details

#__pipe__(*args, &block) ⇒ Object



13
14
15
# File 'lib/pipe_operator.rb', line 13

def __pipe__(*args, &block)
  Pipe.new(self, *args, &block)
end