Class: Keyremac::Autogen::KeyOverlaidModifier

Inherits:
Object
  • Object
show all
Defined in:
lib/keyremac/base.rb,
lib/keyremac/dump.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, mod, keys: [], repeat: false) ⇒ KeyOverlaidModifier

Returns a new instance of KeyOverlaidModifier.



29
30
31
32
33
34
# File 'lib/keyremac/base.rb', line 29

def initialize(key, mod, keys: [], repeat: false)
  @key = key
  @mod = mod
  @keys = keys == [] ? [key] : keys
  @repeat = repeat
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



28
29
30
# File 'lib/keyremac/base.rb', line 28

def key
  @key
end

#keysObject (readonly)

Returns the value of attribute keys.



28
29
30
# File 'lib/keyremac/base.rb', line 28

def keys
  @keys
end

#modObject (readonly)

Returns the value of attribute mod.



28
29
30
# File 'lib/keyremac/base.rb', line 28

def mod
  @mod
end

#repeatObject (readonly)

Returns the value of attribute repeat.



28
29
30
# File 'lib/keyremac/base.rb', line 28

def repeat
  @repeat
end

Instance Method Details

#dump(xml) ⇒ Object



52
53
54
55
56
# File 'lib/keyremac/dump.rb', line 52

def dump(xml)
  seqs = [key, mod, *keys].map { |k| k.dump(xml) }.join(', ')
  autogen = repeat ? '__KeyOverlaidModifierWithRepeat__' : '__KeyOverlaidModifier__'
  xml.autogen "#{autogen} #{seqs}"
end

#repeat?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/keyremac/base.rb', line 36

def repeat?
  @repeat
end