Class: RegexpPreview::MultiLine

Inherits:
Object
  • Object
show all
Defined in:
lib/regexp_preview/multi_line.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, format, params = {}) ⇒ MultiLine

Returns a new instance of MultiLine.



5
6
7
8
9
# File 'lib/regexp_preview/multi_line.rb', line 5

def initialize(file, format, params = {})
  @file = file
  @format = format
  @params = params[:params]
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



3
4
5
# File 'lib/regexp_preview/multi_line.rb', line 3

def file
  @file
end

#formatObject (readonly)

Returns the value of attribute format.



3
4
5
# File 'lib/regexp_preview/multi_line.rb', line 3

def format
  @format
end

#paramsObject (readonly)

Returns the value of attribute params.



3
4
5
# File 'lib/regexp_preview/multi_line.rb', line 3

def params
  @params
end

Instance Method Details

#matches_jsonObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/regexp_preview/multi_line.rb', line 11

def matches_json
  {
    params: {
      setting: { # for vue.js
        regexp: nil,
        time_format: nil,
      }
    },
    matches: matches.compact,
  }
end