Skip to content

Commit

Permalink
add object demo
Browse files Browse the repository at this point in the history
  • Loading branch information
monodot committed Nov 16, 2020
1 parent 3da64c6 commit de38112
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Jenkinsfile.demo
@@ -1,5 +1,6 @@
@Library('mylibrary')
import com.cleverbuilder.GlobalVars
import com.cleverbuilder.SampleClass

pipeline {
agent any
Expand All @@ -10,6 +11,10 @@ pipeline {
sayHello 'Dave'

echo 'The value of foo is : ' + GlobalVars.foo

person = new SampleClass()
person.increaseAge(10)
echo 'Incremented age, is now : ' + person.age
}
}
}
Expand Down
11 changes: 11 additions & 0 deletions src/com/cleverbuilder/SampleClass.groovy
@@ -0,0 +1,11 @@
#!/usr/bin/env groovy
package com.cleverbuilder

class SampleClass {
String name
Integer age

def increaseAge(Integer years) {
this.age += years
}
}

0 comments on commit de38112

Please sign in to comment.