daily pastebin goal
22%
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Should my class methods have access to my class variables?
  2.  
  3. NameError: uninitialized class variable @@file_type in NetworkAssetFile::NetworkAssetBase
  4.         from /home/jontec/public_html/dvd2/app/helpers/network_asset_file.rb:94:in `lookup'
  5.         from /home/jontec/public_html/dvd2/app/helpers/network_asset_file.rb:86:in `each'
  6.         from /home/jontec/public_html/dvd2/app/helpers/network_asset_file.rb:86:in `lookup'
  7.         from /home/jontec/public_html/dvd2/app/models/network_asset_extensions.rb:3:in `find'
  8.         from (irb):1
  9.  
  10. ## network_asset_file.rb [ruby]
  11. module NetworkAssetFile
  12.   module NetworkAssetBase
  13.     # this module is used to extend my NetworkAsset classes
  14.     def lookup
  15.       ...
  16.       if @@file_type
  17.         search_regex << "\\.#{ @@file_type }"
  18.       else
  19.         search_regex << '\.\w+'
  20.       end
  21.       ...
  22.     end
  23.   end
  24. end
  25.  
  26. ## network_function_file.rb [ruby]
  27. class NetworkFunctionFile
  28.   extend NetworkAssetFile::NetworkAssetBase # added as class methods
  29.   ...
  30.   @@file_type = "txt"
  31.   ...
  32. end
RAW Paste Data
Top