Class: DataMapper::YS::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/dm-ys/config.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = nil) ⇒ Config

Returns a new instance of Config.



8
9
10
11
# File 'lib/dm-ys/config.rb', line 8

def initialize(options = nil)
  @options = options
  @options = self.class.default unless @options.is_a?(Hash)
end

Class Method Details

.defaultObject



4
5
6
# File 'lib/dm-ys/config.rb', line 4

def self.default
  {:max_pages=>100, :uniq=>true, :only_path=>false}
end

Instance Method Details

#[](key) ⇒ Object



13
14
15
# File 'lib/dm-ys/config.rb', line 13

def [](key)
  @options[key]
end

#[]=(key, val) ⇒ Object



17
18
19
# File 'lib/dm-ys/config.rb', line 17

def []=(key, val)
  @options[key] = val
end

#only_path?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/dm-ys/config.rb', line 29

def only_path?
  !!self[:only_path]
end

#uniq_entry?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/dm-ys/config.rb', line 25

def uniq_entry?
  self[:uniq] == true or self[:uniq] == :entry
end

#uniq_page?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/dm-ys/config.rb', line 21

def uniq_page?
  !!self[:uniq]
end