lib/scoutui/commands/utils.rb in scoutui-2.0.3.23.pre vs lib/scoutui/commands/utils.rb in scoutui-2.0.3.24.pre

- old
+ new

@@ -36,10 +36,72 @@ @totalCommands[c]=0 end @useFrameSearch = false + + @transList={ + '__CHAR10__' => lambda { }, + '__CITY__' => lambda { Faker::Address.city.to_s }, + '__COMPANY.NAME__' => lambda { Faker::Company.name.to_s }, + '__COMPANY.EIN__' => lambda { Faker::Company.ein.to_s }, + '__COUNTRY__' => lambda { Faker::Address.country.to_s }, + '__DATE__' => lambda { Time.now().to_s }, + '__EMAIL__' => lambda { Faker::Internet.email.to_s}, + '__DDMMYY__' => lambda { Date.parse(Time.now.to_s).strftime("%d%m%Y") }, + '__PARAGRAPH__' => lambda { Faker::Lorem.paragraph.to_s }, + '__PASSWORD__' => lambda { Faker::Internet.password.to_s }, + '__PHONENUMBER__' => lambda { Faker::PhoneNumber.phone_number.to_s }, + '__PHONENUMBER.AREACODE__' => lambda { Faker::Config.locale = 'en-US'; Faker::PhoneNumber.area_code.to_s }, + '__PHONENUMBER.EXCHANGE__' => lambda { Faker::Config.locale = 'en-US'; Faker::PhoneNumber.exchange_code.to_s }, + '__PHONENUMBER.SUBSCRIBER__' => lambda { Faker::PhoneNumber.subscriber_number.to_s }, + '__PHONENUMBER.EXT__' => lambda { Faker::PhoneNumber.extension.to_s }, + '__NUMBER__' => lambda { Faker::Number.number(5).to_s}, + '__NUMBER(1)__' => lambda { Faker::Number.number(1).to_s}, + '__NUMBER(2)__' => lambda { Faker::Number.number(2).to_s}, + '__NUMBER(5)__' => lambda { Faker::Number.number(5).to_s}, + '__NUMBER(8)__' => lambda { Faker::Number.number(8).to_s}, + '__NUMBER(10)__' => lambda { Faker::Number.number(10).to_s}, + '__NUMBER(1,28)__' => lambda { Faker::Number.between(1, 28).to_s }, + '__NUMBER(1, 28)__' => lambda { Faker::Number.between(1, 28).to_s }, + '__NUMBER(1,29)__' => lambda { Faker::Number.between(1, 29).to_s }, + '__NUMBER(1, 29)__' => lambda { Faker::Number.between(1, 29).to_s }, + '__NUMBER(1,30)__' => lambda { Faker::Number.between(1, 30).to_s }, + '__NUMBER(1, 30)__' => lambda { Faker::Number.between(1, 30).to_s }, + '__NUMBER(1,31)__' => lambda { Faker::Number.between(1, 31).to_s }, + '__NUMBER(1, 31)__' => lambda { Faker::Number.between(1, 31).to_s }, + '__SENTENCE__' => lambda { Faker::Lorem.sentence.to_s }, + '__STREET__' => lambda { Faker::Address.street_address.to_s}, + '__STATE__' => lambda { Faker::Address.state.to_s }, + '__TIME__' => lambda { Time.now.to_s }, + '__TIME.MMDDYY__' => lambda { Time.now.strftime "%m%d%y" }, + '__TIME.MMDDYY.HM__' => lambda { Time.now.strftime "%m%d%y.%H%M" }, + '__TIME.MMDDYY.HMS__' => lambda { Time.now.strftime "%m%d%y.%H%M%S" }, + '__USERNAME__' => lambda { Faker::Internet.user_name.to_s }, + '__ZIP__' => lambda { Faker::Address.zip_code.to_s }, + } + @hwnds = { :current => nil, :previous => nil, :handles => [] } + end + + + def expandMacro(_text_to_type) + + Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " expandMacro(#{_text_to_type})" + + + @transList.each_pair do |_k, _v| + + if _text_to_type.include?(_k.to_s) + _dynamicStr = _v.call.to_s + _text_to_type.gsub!(_k.to_s, _dynamicStr) + end + end + + puts __FILE__ + (__LINE__).to_s + " Text to type : #{_text_to_type}" + + _text_to_type.to_s + end def reset(stanza=nil)