Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Should my class methods have access to my class variables?
- NameError: uninitialized class variable @@file_type in NetworkAssetFile::NetworkAssetBase
- from /home/jontec/public_html/dvd2/app/helpers/network_asset_file.rb:94:in `lookup'
- from /home/jontec/public_html/dvd2/app/helpers/network_asset_file.rb:86:in `each'
- from /home/jontec/public_html/dvd2/app/helpers/network_asset_file.rb:86:in `lookup'
- from /home/jontec/public_html/dvd2/app/models/network_asset_extensions.rb:3:in `find'
- from (irb):1
- ## network_asset_file.rb [ruby]
- module NetworkAssetFile
- module NetworkAssetBase
- # this module is used to extend my NetworkAsset classes
- def lookup
- ...
- if @@file_type
- search_regex << "\\.#{ @@file_type }"
- else
- search_regex << '\.\w+'
- end
- ...
- end
- end
- end
- ## network_function_file.rb [ruby]
- class NetworkFunctionFile
- extend NetworkAssetFile::NetworkAssetBase # added as class methods
- ...
- @@file_type = "txt"
- ...
- end
Add Comment
Please, Sign In to add comment