Class: Remi::BusinessRules::Filestore
- Inherits:
-
Object
- Object
- Remi::BusinessRules::Filestore
- Defined in:
- lib/remi/cucumber/business_rules.rb
Instance Attribute Summary collapse
-
#sftp_entries ⇒ Object
readonly
Returns the value of attribute sftp_entries.
Instance Method Summary collapse
- #anti_pattern(pattern) ⇒ Object
- #delivered_before(date_time) ⇒ Object
- #delivered_since(date_time) ⇒ Object
- #generate ⇒ Object
-
#initialize ⇒ Filestore
constructor
A new instance of Filestore.
- #latest ⇒ Object
- #pattern(pattern) ⇒ Object
Constructor Details
#initialize ⇒ Filestore
Returns a new instance of Filestore.
564 565 566 567 |
# File 'lib/remi/cucumber/business_rules.rb', line 564 def initialize @files = [] @delivered = {} end |
Instance Attribute Details
#sftp_entries ⇒ Object (readonly)
Returns the value of attribute sftp_entries.
569 570 571 |
# File 'lib/remi/cucumber/business_rules.rb', line 569 def sftp_entries @sftp_entries end |
Instance Method Details
#anti_pattern(pattern) ⇒ Object
575 576 577 |
# File 'lib/remi/cucumber/business_rules.rb', line 575 def anti_pattern(pattern) @pattern = /^ThisBetterNeverMatchAnythingOrIWillShootYou\d{8}Times$/ end |
#delivered_before(date_time) ⇒ Object
583 584 585 |
# File 'lib/remi/cucumber/business_rules.rb', line 583 def delivered_before(date_time) @delivered = { :before => date_time } end |
#delivered_since(date_time) ⇒ Object
579 580 581 |
# File 'lib/remi/cucumber/business_rules.rb', line 579 def delivered_since(date_time) @delivered = { :since => date_time } end |
#generate ⇒ Object
591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 |
# File 'lib/remi/cucumber/business_rules.rb', line 591 def generate psuedorand = Random.new(4985674985672348954987589429) generate_files_with_pattern @files.map! do |file| date_method = @delivered.keys.first if date_method == :since file[:attributes][:createdtime] = @delivered[:since] + 10 + psuedorand.rand * 100 elsif date_method == :before file[:attributes][:createdtime] = @delivered[:since] - 10 - psuedorand.rand * 100 else file[:attributes][:createdtime] = Time.now - 10 - psuedorand.rand * 100 end file end end |
#latest ⇒ Object
587 588 589 |
# File 'lib/remi/cucumber/business_rules.rb', line 587 def latest @files.max_by { |f| f[:attributes][:createdtime] }[:name] end |
#pattern(pattern) ⇒ Object
571 572 573 |
# File 'lib/remi/cucumber/business_rules.rb', line 571 def pattern(pattern) @pattern = pattern end |