File: lazy_arg.rb

package info (click to toggle)
ruby-rspec-parameterized-core 2.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 204 kB
  • sloc: ruby: 647; sh: 4; makefile: 4
file content (21 lines) | stat: -rw-r--r-- 385 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module RSpec
  module Parameterized
    module Core
      class LazyArg < Arg
        def initialize(&block)
          @block = block
        end

        def apply(obj)
          obj.instance_eval(&@block)
        end

        def inspect
          CompositeParser.to_raw_source(@block)
        rescue ParserSyntaxError
          super.inspect
        end
      end
    end
  end
end