Class: Class

Inherits:
Object show all
Defined in:
lib/ruby-serial/_class.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dont_rubyserial_lstObject (readonly)

Returns the value of attribute dont_rubyserial_lst.



3
4
5
# File 'lib/ruby-serial/_class.rb', line 3

def dont_rubyserial_lst
  @dont_rubyserial_lst
end

#rubyserial_only_lstObject (readonly)

Returns the value of attribute rubyserial_only_lst.



4
5
6
# File 'lib/ruby-serial/_class.rb', line 4

def rubyserial_only_lst
  @rubyserial_only_lst
end

Instance Method Details

#dont_rubyserial(*lst) ⇒ Object

Mark some attributes to not be serialized

Parameters
  • lst (list<Symbol>): List of attributes symbols



10
11
12
13
14
15
# File 'lib/ruby-serial/_class.rb', line 10

def dont_rubyserial(*lst)
  lst = [lst] if (!lst.is_a?(Array))
  @dont_rubyserial_lst = [] if (!defined?(@dont_rubyserial_lst))
  @dont_rubyserial_lst.concat(lst.map { |var_name| "@#{var_name.to_s}".to_sym })
  @dont_rubyserial_lst.uniq!
end

#rubyserial_only(*lst) ⇒ Object

Mark some attributes to be serialized

Parameters
  • lst (list<Symbol>): List of attributes symbols



21
22
23
24
25
26
# File 'lib/ruby-serial/_class.rb', line 21

def rubyserial_only(*lst)
  lst = [lst] if (!lst.is_a?(Array))
  @rubyserial_only_lst = [] if (!defined?(@rubyserial_only_lst))
  @rubyserial_only_lst.concat(lst.map { |var_name| "@#{var_name.to_s}".to_sym })
  @rubyserial_only_lst.uniq!
end