Class: Lazylead::ORM::Task

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Lazylead::ORM
Defined in:
lib/lazylead/model.rb

Overview

General lazylead task.

Instance Method Summary collapse

Methods included from Lazylead::ORM

#env, #inspect, #to_hash, #to_s

Instance Method Details

#detect_cc(sys) ⇒ Object



104
105
106
107
108
109
# File 'lib/lazylead/model.rb', line 104

def detect_cc(sys)
  opts = props
  opts["cc"] = CC.new.detect(opts["cc"], sys)
  return opts.except "cc" if opts["cc"].is_a? EmptyCC
  opts
end

#execObject



97
98
99
100
101
102
# File 'lib/lazylead/model.rb', line 97

def exec
  sys = system.connect
  opts = props
  opts = detect_cc(sys) if opts.key? "cc"
  action.constantize.new.run(sys, postman, opts)
end

#postmanObject



121
122
123
124
125
126
127
# File 'lib/lazylead/model.rb', line 121

def postman
  if props.key? "postman"
    props["postman"].constantize.new
  else
    Postman.new
  end
end

#propsObject



111
112
113
114
115
116
117
118
119
# File 'lib/lazylead/model.rb', line 111

def props
  @props ||= begin
               if team.nil?
                 Opts.new(env(to_hash))
               else
                 Opts.new(env(team.to_hash.merge(to_hash)))
               end
             end
end