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, args, block) ⇒ Field

Returns a new instance of Field.



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

def initialize(name, typ, args, block)
  @name=name
  @typ=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



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

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

Instance Method Details

#respond_to?(arg) ⇒ Boolean

Returns:

  • (Boolean)


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

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