Class: Rstruct::Field

Inherits:
Object
  • Object
show all
Defined in:
lib/rstruct/field.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, typ, typ_name, args, block) ⇒ Field



5
6
7
8
9
10
11
# File 'lib/rstruct/field.rb', line 5

def initialize(name, typ, typ_name, args, block)
  @name=name
  @typ=typ
  @typ_name = typ_name || typ
  @args=args
  @block=block
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



17
18
19
# File 'lib/rstruct/field.rb', line 17

def method_missing(name, *args, &block)
  @typ.__send__(name, *args, &block)
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



3
4
5
# File 'lib/rstruct/field.rb', line 3

def args
  @args
end

#blockObject (readonly)

Returns the value of attribute block.



3
4
5
# File 'lib/rstruct/field.rb', line 3

def block
  @block
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/rstruct/field.rb', line 3

def name
  @name
end

#typObject (readonly)

Returns the value of attribute typ.



3
4
5
# File 'lib/rstruct/field.rb', line 3

def typ
  @typ
end

#typ_nameObject (readonly)

Returns the value of attribute typ_name.



3
4
5
# File 'lib/rstruct/field.rb', line 3

def typ_name
  @typ_name
end

Instance Method Details

#respond_to?(arg) ⇒ Boolean



13
14
15
# File 'lib/rstruct/field.rb', line 13

def respond_to?(arg)
  super(arg) || @typ.respond_to?(arg)
end