summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/pipeline/expression/lexeme/string.rb
blob: 6f77d443c3c0a64d0e536a8234a2f1322c74371f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
module Gitlab
  module Ci
    module Pipeline
      module Expression
        module Lexeme
          class String < Lexeme::Value
            PATTERN = /"(?<string>.+?)"/.freeze

            def initialize(value)
              @value = value
            end

            def evaluate(**_)
              @value.to_s
            end

            def self.build(string)
              new(string.match(PATTERN)[:string])
            end
          end
        end
      end
    end
  end
end