class SOCMaker::LibInc
A small class, which represents a library-include information. The included directories are stored in @dirs
Attributes
dirs[RW]
the included directories
Public Class Methods
new( opts = {} )
click to toggle source
This constructor does nothing special. The directories can be passed via optional arguments
# File lib/soc_maker/lib_inc.rb, line 54 def initialize( opts = {} ) init_with( opts ) end
Public Instance Methods
==(o)
click to toggle source
Equality operator
# File lib/soc_maker/lib_inc.rb, line 100 def ==(o) o.class == self.class && o.dirs == self.dirs end
encode_with( coder )
click to toggle source
Encoder method (to yaml)
coder
-
An instance of the Psych::Coder to encode this class to a YAML file
# File lib/soc_maker/lib_inc.rb, line 63 def encode_with( coder ) init_error_if !coder.is_a?( Psych::Coder ), 'coder is not given as Psych::Coder' %w[ dirs ]. each { |v| coder[ v ] = instance_variable_get "@#{v}" } end
init_with( coder )
click to toggle source
Initialization method (from yaml)
coder
-
An instance of the Psych::Coder to init this class from a YAML file
# File lib/soc_maker/lib_inc.rb, line 76 def init_with( coder ) init_error_if !( coder.is_a?( Hash ) || coder.is_a?( Psych::Coder ) ), 'coder is not given as Hash neither as Psych::Coder' init_error 'no dirs are given' if coder[ 'dirs' ] == nil @dirs = coder[ 'dirs' ] init_error 'dirs must be of type array' if !@dirs.is_a?( Array ) init_error 'there must be at least one dir-entry' if @dirs.size == 0 @dirs.each do |f| init_error "The dir must be defined as string", field: 'dirs' if !f.is_a?( String ) init_error "The path string has zero length", field: 'dirs' if f.size == 0 end end