Class: Fall::Record

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/fall/record.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#deflate, #deflate!, #deflate64, #inflate, #inflate!, #inflate64, #inflate64bed, #parsedate

Constructor Details

#initialize(value) ⇒ Record

Returns a new instance of Record.



30
31
32
# File 'lib/fall/record.rb', line 30

def initialize(value)
  @value = value
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object (private)



74
75
76
77
78
79
80
# File 'lib/fall/record.rb', line 74

def method_missing(method_name, *args, &block)
  if @value.respond_to?(method_name)
    @value.public_send(method_name, *args, &block)
  else
    super
  end
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



5
6
7
# File 'lib/fall/record.rb', line 5

def value
  @value
end

Class Method Details

.wrap(value) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/fall/record.rb', line 19

def self.wrap(value)
  case value
  in Record
    value
  else
    new(value)
  end
end

Instance Method Details

#discard?Boolean

Returns:

  • (Boolean)


38
39
40
41
42
43
44
# File 'lib/fall/record.rb', line 38

def discard?
  case value
  in :__discard then true
  in [*, :__discard, *] then true
  else false
  end
end

#to_aryObject Also known as: to_a



61
62
63
64
65
66
67
68
# File 'lib/fall/record.rb', line 61

def to_ary
  case value
  in Array
    value
  else
    [value]
  end
end

#zip(other) ⇒ Object



34
35
36
# File 'lib/fall/record.rb', line 34

def zip(other)
  to_ary.zip(other.to_ary)
end