Class: Rust::Plots::GGPlot::Theme::Element
- Inherits:
-
Object
- Object
- Rust::Plots::GGPlot::Theme::Element
show all
- Defined in:
- lib/rust/external/ggplot2/themes.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(**options) ⇒ Element
Returns a new instance of Element.
84
85
86
|
# File 'lib/rust/external/ggplot2/themes.rb', line 84
def initialize(**options)
@options = options
end
|
Instance Attribute Details
Returns the value of attribute options.
82
83
84
|
# File 'lib/rust/external/ggplot2/themes.rb', line 82
def options
@options
end
|
Instance Method Details
#r_function ⇒ Object
88
89
90
|
# File 'lib/rust/external/ggplot2/themes.rb', line 88
def r_function
raise "Not implemented for generic theme element"
end
|
101
102
103
104
105
|
# File 'lib/rust/external/ggplot2/themes.rb', line 101
def to_h
hash = @options.clone
hash['_type'] = self.class.name
return hash
end
|
92
93
94
95
96
97
98
99
|
# File 'lib/rust/external/ggplot2/themes.rb', line 92
def to_R
options = @options.map { |k, v| [k.to_s.gsub("_", "."), v] }.to_h
function = Rust::Function.new(self.r_function)
function.options = Rust::Options.from_hash(options)
return function.to_R
end
|