class Cut::Mapping

Attributes

name[R]

Public Class Methods

new(name, options = {}) click to toggle source
# File lib/cut/mapping.rb, line 6
def initialize(name, options = {})
  @name      = name
  @selector  = options[:to]
  @operation = options[:operation]
end

Public Instance Methods

operation() click to toggle source
# File lib/cut/mapping.rb, line 16
def operation
  @operation ||= Proc.new {|value| value }
end
selector() click to toggle source
# File lib/cut/mapping.rb, line 12
def selector
  @selector ||= ".#{name}"
end
value_from_node(node) click to toggle source
# File lib/cut/mapping.rb, line 20
def value_from_node(node)
  operation.call( node.at_css(selector).value.to_s )
end