Class: Rbind::RAttribute

Inherits:
RBase
  • Object
show all
Defined in:
lib/rbind/core/rattribute.rb

Direct Known Subclasses

RParameter

Instance Attribute Summary collapse

Attributes inherited from RBase

#alias, #auto_alias, #cname, #csignature, #doc, #extern_package_name, #ignore, #name, #namespace, #owner, #signature, #version

Instance Method Summary collapse

Methods inherited from RBase

basename, #binding, #delete!, #doc?, #extern?, #full_name, #ignore?, #map_to_namespace, namespace, #namespace?, normalize, #overwrite_c, #overwrite_ruby, #pretty_print, #rename, #specialize_ruby, split_name, to_cname, #to_s

Constructor Details

#initialize(name, type) ⇒ RAttribute

Returns a new instance of RAttribute.

Raises:

  • (ArgumentError)


5
6
7
8
9
10
11
# File 'lib/rbind/core/rattribute.rb', line 5

def initialize(name,type)
    super(name)
    raise ArgumentError,"no type" unless type
    @type = type
    @readable = true
    @writable = false
end

Instance Attribute Details

#typeObject

Returns the value of attribute type.



3
4
5
# File 'lib/rbind/core/rattribute.rb', line 3

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/rbind/core/rattribute.rb', line 13

def ==(other)
    if other
        type == other.type
    else
        false
    end
end

#generate_signaturesObject



21
22
23
24
25
# File 'lib/rbind/core/rattribute.rb', line 21

def generate_signatures
    @type.generate_signatures.map do |s|
        "#{s} #{name}"
    end
end

#readable!(value = true) ⇒ Object



27
28
29
30
# File 'lib/rbind/core/rattribute.rb', line 27

def readable!(value = true)
    @readable = value
    self
end

#readable?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/rbind/core/rattribute.rb', line 37

def readable?
    !!@readable
end

#writeable!(value = true) ⇒ Object



32
33
34
35
# File 'lib/rbind/core/rattribute.rb', line 32

def writeable!(value = true)
    @writeable = value
    self
end

#writeable?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/rbind/core/rattribute.rb', line 41

def writeable?
    !!@writeable
end