Module: Woothee::Util

Included in:
Appliance, Browser, Crawler, Misc, MobilePhone, OS
Defined in:
lib/woothee/util.rb

Instance Method Summary collapse

Instance Method Details

#update_category(target, category) ⇒ Object



13
14
15
# File 'lib/woothee/util.rb', line 13

def update_category(target, category)
  target[Woothee::ATTRIBUTE_CATEGORY] = category
end

#update_map(target, source) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/woothee/util.rb', line 4

def update_map(target, source)
  source.keys.each do |key|
    next if key == Woothee::KEY_LABEL or key == Woothee::KEY_TYPE
    if source[key].length > 0
      target[key] = source[key]
    end
  end
end

#update_os(target, os) ⇒ Object



21
22
23
# File 'lib/woothee/util.rb', line 21

def update_os(target, os)
  target[Woothee::ATTRIBUTE_OS] = os
end

#update_os_version(target, version) ⇒ Object



25
26
27
# File 'lib/woothee/util.rb', line 25

def update_os_version(target, version)
  target[Woothee::ATTRIBUTE_OS_VERSION] = version
end

#update_version(target, version) ⇒ Object



17
18
19
# File 'lib/woothee/util.rb', line 17

def update_version(target, version)
  target[Woothee::ATTRIBUTE_VERSION] = version
end