Class: AdvAccessor::Mapping

Inherits:
Object
  • Object
show all
Includes:
FromHash
Defined in:
lib/adv_accessor/mapping.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#baseObject

Returns the value of attribute base.



4
5
6
# File 'lib/adv_accessor/mapping.rb', line 4

def base
  @base
end

#blockObject

Returns the value of attribute block.



4
5
6
# File 'lib/adv_accessor/mapping.rb', line 4

def block
  @block
end

#fromObject

Returns the value of attribute from.



4
5
6
# File 'lib/adv_accessor/mapping.rb', line 4

def from
  @from
end

#toObject

Returns the value of attribute to.



4
5
6
# File 'lib/adv_accessor/mapping.rb', line 4

def to
  @to
end

Instance Method Details

#match?(ops) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
10
11
12
# File 'lib/adv_accessor/mapping.rb', line 6

def match?(ops)
  if base.act_on_array && ops[:val].kind_of?(Array)
    from == ops[:val].first.class && to == ops[:to]
  else
    from == ops[:val].class && to == ops[:to]
  end
end