Class: OroGen::Gen::RTT_CPP::BuildDependency

Inherits:
Object
  • Object
show all
Defined in:
lib/orogen/gen/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(var_name, pkg_name) ⇒ BuildDependency


54
55
56
57
58
# File 'lib/orogen/gen/base.rb', line 54

def initialize(var_name, pkg_name)
    @var_name = var_name.gsub(/[^\w]/, '_')
    @pkg_name = pkg_name
    @context = []
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context


52
53
54
# File 'lib/orogen/gen/base.rb', line 52

def context
  @context
end

#pkg_nameObject (readonly)

Returns the value of attribute pkg_name


50
51
52
# File 'lib/orogen/gen/base.rb', line 50

def pkg_name
  @pkg_name
end

#var_nameObject (readonly)

Returns the value of attribute var_name


49
50
51
# File 'lib/orogen/gen/base.rb', line 49

def var_name
  @var_name
end

Instance Method Details

#in_context(*args) ⇒ Object


60
61
62
63
# File 'lib/orogen/gen/base.rb', line 60

def in_context(*args)
    context << args.to_set
    self
end

#in_context?(*args) ⇒ Boolean


74
75
76
77
78
79
# File 'lib/orogen/gen/base.rb', line 74

def in_context?(*args)
    args = args.to_set
    context.any? do |ctx|
        (args & ctx).size == args.size
    end
end

#remove_context(*args) ⇒ Object


65
66
67
68
69
70
71
72
# File 'lib/orogen/gen/base.rb', line 65

def remove_context(*args)
    args = args.to_set
    @context = context.dup
    context.delete_if do |ctx|
        (args & ctx).size == args.size
    end
    self
end