Module: Mechanize::Config
- Defined in:
- lib/mechanize_rspec/config.rb
Class Method Summary collapse
-
.check_location ⇒ Object
Sprawdzenie czy wszystkie wskazane ścieżki do plików lokalnych istnieją.
- .dirname ⇒ Object
- .dirname=(value) ⇒ Object
- .error_uris ⇒ Object
-
.get_location ⇒ Object
pobranie hasha lokalizacji ze wskazanego pliku o ile istnieje.
- .location ⇒ Object
- .push_error_uri(uri) ⇒ Object
- .push_uri(uri) ⇒ Object
- .uris ⇒ Object
Class Method Details
.check_location ⇒ Object
Sprawdzenie czy wszystkie wskazane ścieżki do plików lokalnych istnieją
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/mechanize_rspec/config.rb', line 46 def self.check_location location.each do |uri, path| path = ::File.join("#{dirname}", path) if ::File.exist?(path) puts "file #{path} exist." else puts "file #{path} don't exist." end end end |
.dirname ⇒ Object
23 24 25 |
# File 'lib/mechanize_rspec/config.rb', line 23 def self.dirname @dirname || nil end |
.dirname=(value) ⇒ Object
18 19 20 21 |
# File 'lib/mechanize_rspec/config.rb', line 18 def self.dirname=(value) return unless ::Dir.exist?(value) @dirname, @location = value, nil end |
.error_uris ⇒ Object
27 28 29 |
# File 'lib/mechanize_rspec/config.rb', line 27 def self.error_uris @error_uris end |
.get_location ⇒ Object
pobranie hasha lokalizacji ze wskazanego pliku o ile istnieje
11 12 13 14 15 16 |
# File 'lib/mechanize_rspec/config.rb', line 11 def self.get_location file_source = ::File.join("#{dirname}", "location.yml") return {} unless ::File.exist?(file_source) result = YAML::load(::File.read(file_source)) result.class == Hash ? result : {} end |
.location ⇒ Object
6 7 8 |
# File 'lib/mechanize_rspec/config.rb', line 6 def self.location @location ||= get_location end |
.push_error_uri(uri) ⇒ Object
31 32 33 34 |
# File 'lib/mechanize_rspec/config.rb', line 31 def self.push_error_uri(uri) @error_uris ||= [] @error_uris << uri end |
.push_uri(uri) ⇒ Object
40 41 42 43 |
# File 'lib/mechanize_rspec/config.rb', line 40 def self.push_uri(uri) @uris ||= [] @uris << uri end |
.uris ⇒ Object
36 37 38 |
# File 'lib/mechanize_rspec/config.rb', line 36 def self.uris @uris end |