Class: CADataFrame::Arranger
- Inherits:
-
Object
- Object
- CADataFrame::Arranger
- Defined in:
- lib/carray-dataframe/arranger.rb
Instance Method Summary collapse
- #arrange(&block) ⇒ Object
-
#initialize(dataframe) ⇒ Arranger
constructor
A new instance of Arranger.
Constructor Details
#initialize(dataframe) ⇒ Arranger
Returns a new instance of Arranger.
9 10 11 |
# File 'lib/carray-dataframe/arranger.rb', line 9 def initialize (dataframe) @dataframe = dataframe end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object (private)
198 199 200 201 202 203 204 205 206 207 |
# File 'lib/carray-dataframe/arranger.rb', line 198 def method_missing (name, *args) if args.size == 0 if @dataframe.column_names.include?(name.to_s) return @dataframe.columns[name.to_s] elsif @dataframe.__methods__.include?(name.to_s) return @dataframe.columns[@dataframe.__methods__[name.to_s]] end end super end |
Instance Method Details
#arrange(&block) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/carray-dataframe/arranger.rb', line 13 def arrange (&block) case block.arity when 1 instance_exec(@dataframe, &block) else instance_exec(&block) end return @dataframe end |