Class: Epuber::Book::FileRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/epuber/book/file_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source_pattern, only_one: true, group: nil, properties: []) ⇒ FileRequest



32
33
34
35
36
37
# File 'lib/epuber/book/file_request.rb', line 32

def initialize(source_pattern, only_one: true, group: nil, properties: [])
  @source_pattern = source_pattern
  @only_one       = only_one
  @group          = group
  @properties     = properties.to_set
end

Instance Attribute Details

#groupSymbol



12
13
14
# File 'lib/epuber/book/file_request.rb', line 12

def group
  @group
end

#only_oneBool

When looking for file, the resulted list should contain only one file

Default: true



20
21
22
# File 'lib/epuber/book/file_request.rb', line 20

def only_one
  @only_one
end

#propertiesSet<String>



24
25
26
# File 'lib/epuber/book/file_request.rb', line 24

def properties
  @properties
end

#source_patternString



8
9
10
# File 'lib/epuber/book/file_request.rb', line 8

def source_pattern
  @source_pattern
end

Instance Method Details

#==(other) ⇒ Object



53
54
55
56
57
58
59
# File 'lib/epuber/book/file_request.rb', line 53

def ==(other)
  if other.is_a?(String)
    @source_pattern == other
  else
    @source_pattern == other.source_pattern && @group == other.group && @only_one == other.only_one
  end
end

#eql?(other) ⇒ Bool



41
42
43
# File 'lib/epuber/book/file_request.rb', line 41

def eql?(other)
  self == other
end

#hashNumeric



47
48
49
# File 'lib/epuber/book/file_request.rb', line 47

def hash
  [@source_pattern, @group, @only_one].hash
end

#to_sString



63
64
65
# File 'lib/epuber/book/file_request.rb', line 63

def to_s
  "#<#{self.class} pattern:`#{@source_pattern}` group:`#{@group}` only_one:`#{@only_one}`>"
end