Class: TriggerEvent

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ TriggerEvent



8
9
10
11
12
13
14
15
16
# File 'lib/trigger_event.rb', line 8

def initialize(argv)
    data = argv.first
    json = JSON.parse(data)
    # p json
    msg = json['commits'].first['message']
    /【([a-zA-Z0-9]*)】/.match(msg)
    @fwk = $1
    @commit = json['after']
end

Instance Attribute Details

#commitObject

Returns the value of attribute commit.



6
7
8
# File 'lib/trigger_event.rb', line 6

def commit
  @commit
end

#fwkObject

Returns the value of attribute fwk.



5
6
7
# File 'lib/trigger_event.rb', line 5

def fwk
  @fwk
end

Instance Method Details

#validate_objectObject



18
19
20
21
22
23
24
25
26
# File 'lib/trigger_event.rb', line 18

def validate_object
    p @fwk
    p @commit
    if @fwk.nil? || @commit.nil?
        p "no framework or commit founds"
        return nil
    end
    return @fwk,@commit
end