Class: Javy::Platform
- Inherits:
-
Struct
- Object
- Struct
- Javy::Platform
- Defined in:
- ext/javy/javy.rb
Instance Attribute Summary collapse
-
#ruby_platform ⇒ Object
Returns the value of attribute ruby_platform.
Instance Method Summary collapse
- #cpu ⇒ Object
- #format_executable_path(path) ⇒ Object
-
#initialize(ruby_platform = RUBY_PLATFORM) ⇒ Platform
constructor
A new instance of Platform.
- #os ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(ruby_platform = RUBY_PLATFORM) ⇒ Platform
Returns a new instance of Platform.
165 166 167 |
# File 'ext/javy/javy.rb', line 165 def initialize(ruby_platform = RUBY_PLATFORM) super(ruby_platform) end |
Instance Attribute Details
#ruby_platform ⇒ Object
Returns the value of attribute ruby_platform
164 165 166 |
# File 'ext/javy/javy.rb', line 164 def ruby_platform @ruby_platform end |
Instance Method Details
#cpu ⇒ Object
184 185 186 187 188 189 190 191 192 193 |
# File 'ext/javy/javy.rb', line 184 def cpu case ruby_platform when /x64/, /x86_64/ "x86_64" when /arm/ "arm" else raise InstallationError.cpu_unsupported end end |
#format_executable_path(path) ⇒ Object
195 196 197 198 199 200 201 202 |
# File 'ext/javy/javy.rb', line 195 def format_executable_path(path) case os when "windows" File.extname(path) != ".exe" ? path + ".exe" : path else path end end |
#os ⇒ Object
173 174 175 176 177 178 179 180 181 182 |
# File 'ext/javy/javy.rb', line 173 def os case ruby_platform when /linux/ "linux" when /darwin/ "macos" else "windows" end end |
#to_s ⇒ Object
169 170 171 |
# File 'ext/javy/javy.rb', line 169 def to_s format("%{cpu}-%{os}", cpu: cpu, os: os) end |