Class: Deal::DealResult

Inherits:
Object
  • Object
show all
Defined in:
lib/deal/utils/deal_config.rb

Instance Method Summary collapse

Constructor Details

#initialize(type, item, match_key, action, path) ⇒ DealResult

Returns a new instance of DealResult.



20
21
22
23
24
25
26
# File 'lib/deal/utils/deal_config.rb', line 20

def initialize(type,item,match_key,action,path)
    @type = type
    @item = item.strip if item
    @match_key = match_key
    @action = action
    @file_path = path
end

Instance Method Details

#set_line_n(line) ⇒ Object



28
29
30
# File 'lib/deal/utils/deal_config.rb', line 28

def set_line_n(line)
    @line_n = line
end

#set_path(path) ⇒ Object



32
33
34
# File 'lib/deal/utils/deal_config.rb', line 32

def set_path(path)
    @file_path = path
end

#to_s(verbose = false) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/deal/utils/deal_config.rb', line 35

def to_s(verbose = false )
    if verbose
        s = []
        s.push '{'
        # s.push "type:#{@type}" if @type
        s.push "match_item:#{@item}" if @item
        s.push "match_key:#{@match_key}" if @match_key
        s.push "action:#{@action}" if @action && @action.length > 0
        s.push "file_path:#{@file_path}" if @file_path
        s.push "line_number:#{@line_n}" if @line_n
        s.push '}'

        return s.join("\n")
    else
        s = []
        s.push "#{@file_path}" if @file_path
        s.push "#{@item}" if @item
        return s.join(":")
    end

end